[BETA] - Flood kontrol Blokları - 1.0.0

Eklentiler ile ilgili gelişmeler. Yeni modlar, güncellemeler.

[BETA] - Flood kontrol Blokları - 1.0.0

İleti sabri ünal 17.07.2006, 14:48

orjinal başlık: http://www.phpbb.com/phpBB/viewtopic.php?t=325374

Bu moda geçen gün canverde de ihtiyaç olmuştu, ben de phpBB sitesine bir bakayım istedim, belki vardır diye... karşıma bu başlık çıktı... iyiki çıktı.... ben de biraz düzenledim...

Flood Kontrol

Üyelerin gönderdikleri mesajlarda ve başlıklarda flood yapmalarına engel olacak bir kaç moda ihtiyaç vardı, ben bunları hazırlayıp bir tek başlık altında topladım...

Kullanım şekli
Burada flood kontrol modunun farklı şekilleri size sunulacaktır... Bütün bu kodların hepsi posting.php dosyasında aynı yere eklenmesi gerekmektedir. Bu açıdan hepsini birden kurmaya kalkmayın!

Flood kontrol kodlarını nereye yerleştirmemiz gerekmektedir

Kod: Tümünü seç
----- [ AÇ ] ---------------------

posting.php

----- [ BUL ] ---------------------

//
// What auth type do we need to check?
//

----- [ ÖNCESİNE EKLE ] ---------------------


Not: Bloklar numaralandırılmıştır. Hata bildirimi yaparken lütfen bu numaraları kullanarak referans veriniz.

Dil dosyasına eklenecek hata mesajları

$lang['flood_error_1'] = 'Sorry, you have already started your maximum number of topics today. Please try again later!';
$lang['flood_error_2'] = 'Sorry, you have already started a topic / the maximum number of topics in this forum!';
$lang['flood_error_3'] = 'Sorry, there are too many topics being started at the moment. Please try again later!';
$lang['flood_error_4'] = 'Sorry, the maximum amount of posts for this forum has been reached today. Please try again later!';
$lang['flood_error_5'] = 'Sorry, your maximum amount of posts for this forum has been reached today. Please try again later!';
$lang['flood_error_6'] = 'Sorry, your maximum amount of posts for today has been reached. Please try again later!';
$lang['flood_error_7'] = 'Sorry, your maximum amount of posts for today has been reached. Please try again later!';

1. YENİ BAŞLIK: Üyelerin 24 saat içinde 3 mesajdan fazla mesaj göndermesine engel olmak

Kod: Tümünü seç
if ($mode == 'newtopic') //Only in these cases
{
  if ($userdata['user_level'] <= USER) //Do not limit MODS and ADMINS in any way
  {
     $time_span = time() - 24*3600; //24 hours
     $topic_limit = 3; // 3 topics per day
     $error_msg = $lang['flood_error_1'];
     $sql = "SELECT count(topic_id) as topic_count
        FROM " . TOPICS_TABLE . "
        WHERE topic_time > $time_span
        AND topic_poster = " . $userdata['user_id'];
     if ( $result = $db->sql_query($sql) )
     {
        $row = $db->sql_fetchrow($result);           
        $topic_count = $row['topic_count'];
        if ($topic_count >= $topic_limit) message_die(GENERAL_MESSAGE, $error_msg);
     }         
  }
}


2. YENİ BAŞLIK: forumlar için zaman sınırı olmaksızın mesaj sınırı

Kod: Tümünü seç
if ($mode == 'newtopic') //Only in these cases
{
  if ($userdata['user_level'] <= USER) //Do not limit MODS and ADMINS in any way
  {
    $forum_list = array(12); //Forum id list like array(1, 2, 3, 5, 8)
    $topic_limit = 1; // 1 topic
     $error_msg = $lang['flood_error_2'];
    if (in_array($forum_id, $forum_list))
    {
      $sql = "SELECT count(topic_id) as topic_count
         FROM ".TOPICS_TABLE."
         WHERE forum_id = $forum_id
           AND topic_poster = ".$userdata['user_id'];
      if ($result = $db->sql_query($sql))
      {
        $row = $db->sql_fetchrow($result));
        $topic_count = $row['topic_count'];
        if ($topic_count >= $topic_limit) message_die(GENERAL_MESSAGE, $error_msg);         
      }
    }
  }
}



3. YENİ BAŞLIK: 3 dakika da 5 mesaj sınırı

Kod: Tümünü seç
if ($mode == 'newtopic') //Only in these cases
{
  if ($userdata['user_level'] <= USER) //Do not limit MODS and ADMINS in any way
  {
     $time_span = time() - 5*60; //5 minutes
     $topic_limit = 3; // 3 topics per 5 minutes   
     $error_msg = $lang['flood_error_3'];
     $sql = "SELECT count(topic_id) as topic_count
        FROM " . TOPICS_TABLE . "
        WHERE topic_time > $time_span";
     if ( $result = $db->sql_query($sql) )
     {
        $row = $db->sql_fetchrow($result);           
        $topic_count = $row['topic_count'];
        if ($topic_count >= $topic_limit) message_die(GENERAL_MESSAGE, $error_msg);
     }         
  }
}


4. YENİ MESAJ: belli forumlar için 24 satte 100 mesaj sınırı

Kod: Tümünü seç
if ($mode == 'reply' || $mode == 'quote' || $mode == 'newtopic') //Only in these cases
{
  if ($userdata['user_level'] <= USER) //Do not limit MODS and ADMINS in any way
  {
    $forum_list = array(12); //Forum id list like array(1, 2, 3, 5, 8)
    $time_span = time() - 24*3600; //24 hours
    $post_limit = 100; //Max messages per time
     $error_msg = $lang['flood_error_4'];
    if (in_array($forum_id, $forum_list))
    {
       $sql = "SELECT count(post_id) as post_count
         FROM " . POSTS_TABLE . "
         WHERE post_time > $time_span
             AND forum_id = $forum_id";
       if ($result = $db->sql_query($sql))
       {
          $row = $db->sql_fetchrow($result);
          $post_count = $row['post_count'];
          if ($post_count >= $post_limit) message_die(GENERAL_MESSAGE, $error_msg);
       }
    }
  }
}


5. YENİ MESAJ: belli forumlar için, 24 saat içinde üye başına 3 mesaj sınırı

Kod: Tümünü seç
if ($mode == 'reply' || $mode == 'quote' || $mode == 'newtopic') //Only in these cases
{
  if ($userdata['user_level'] <= USER) //Do not limit MODS and ADMINS in any way
  {
    $forum_list = array(12); //Forum id list like array(1, 2, 3, 5, 8)
    $time_span = time() - 24*3600; //24 hours
    $post_limit = 3; //Max messages per time
    $error_msg = $lang['flood_error_5'];
    if (in_array($forum_id, $forum_list))
    {
       $sql = "SELECT count(post_id) as post_count
         FROM " . POSTS_TABLE . "
         WHERE post_time > $time_span             
           AND forum_id = $forum_id
           AND poster_id = ".$userdata['user_id'];
       if ($result = $db->sql_query($sql))
       {
          $row = $db->sql_fetchrow($result);
          $post_count = $row['post_count'];
          if ($post_count >= $post_limit) message_die(GENERAL_MESSAGE, $error_msg);
       }
    }
  }
}


6. YENİ MESAJ: üye 15 mesaj ve 50 mesaj arasında ise günde en fazla 3 mesaj gönderebilsin

Kod: Tümünü seç
if ($mode == 'reply' || $mode == 'quote' || $mode == 'newtopic') //Only in these cases
{
  if ($userdata['user_level'] <= USER) //Do not limit MODS and ADMINS in any way
  {
    $time_span = time() - 24*3600; //24 hours
    $post_limit = 3; //Max messages per time
    $threshold = 15; //Until this amount has been posted
    $post_maximum = 50; //Never more than this
    $error_msg = $lang['flood_error_6'];
    $sql = "SELECT count(post_id) as post_count_total
      FROM " . POSTS_TABLE . "
      WHERE poster_id = ".$userdata['user_id'];
    if ($result = $db->sql_query($sql))
    {
      $row = $db->sql_fetchrow($result);
      $post_count_total = $row['post_count_total'];
      $sql = "SELECT count(post_id) as post_count
        FROM " . POSTS_TABLE . "
        WHERE post_time > $time_span
          AND poster_id = ".$userdata['user_id'];
      if ($result = $db->sql_query($sql))
      {
        $row = $db->sql_fetchrow($result);
        $post_count = $row['post_count'];
        if (($post_count_total < $threshold && $post_count >= $post_limit) || $post_count >= $post_maximum ) message_die(GENERAL_MESSAGE, $error_msg);
      }
    }
  }
}


7. YENİ MESAJ: belli bir üyeye, gün başına 10 mesaj sınırı koymak...

Kod: Tümünü seç
if ($mode == 'reply' || $mode == 'quote' || $mode == 'newtopic') //Only in these cases
{
  $user_id_list = array(1); //Fill in the user id(s) of the users you want to block,
   //for example array(5, 10, 45, 81)
  $time_span = time() - 24*3600; //24 hours
  $post_limit = 10; //Max messages per time
  $error_msg = $lang['flood_error_7'];

  if (in_array($userdata['user_id'], $user_id_list) )
  {
     $sql = "SELECT count(post_id) as post_count
       FROM " . POSTS_TABLE . "
       WHERE post_time > $time_span
       AND poster_id = ".$userdata['user_id'];
     if ($result = $db->sql_query($sql))
     {
        $row = $db->sql_fetchrow($result);
        $post_count = $row['post_count'];
        if ($post_count >= $post_limit) message_die(GENERAL_MESSAGE, $error_msg);
     }
  }
}
En son sabri ünal tarafından, 18.07.2006, 01:05 tarihinde değiştirildi, toplamda 1 değişiklik yapıldı.
Mutluyum, biraz komedi takılıyorum! sakın kızmayın yakında geçer, sebebini ben de bilmiyorum! yeni bir aşk da bulmuş değilim!
Kullanıcı avatarı
sabri ünal
Üye
Üye
 
İleti: 1325
Kayıt: 27.10.2005, 15:49
Konum: İstanbul

İleti berkan04 17.07.2006, 23:23

Teşşekürler Sabri Abi de ,

"posting.php " dosyasına en fazla ne kadar kod ekleme şansımız var acaba bir bilgin var mı ?
Hepsini kurmaya kalkmayın demişsinde :D en fazla ne kadar kurabiliriz acaba ?

Biraz saçma bir soeru oldu 6 tane kuracağım Yokta merak ettim :D
Resim
Kullanıcı avatarı
berkan04
Üye
Üye
 
İleti: 117
Kayıt: 13.03.2006, 23:33
Konum: mersin

İleti sabri ünal 18.07.2006, 00:19

7 block var, yedisini de kurabilirsiniz, fakat bu durum bütün sistemi mahfedebilir, fakat istediğinizi tam planlayarak, bu kodlar üstünden çok rahat hazırlayabilirsiniz... mod yazarının aklına bukadar gelmiş, benim aklıma ise bunları mesaj düzenlemeye uyarlamak geliyor :)
Mutluyum, biraz komedi takılıyorum! sakın kızmayın yakında geçer, sebebini ben de bilmiyorum! yeni bir aşk da bulmuş değilim!
Kullanıcı avatarı
sabri ünal
Üye
Üye
 
İleti: 1325
Kayıt: 27.10.2005, 15:49
Konum: İstanbul


Duyurular & Güncellemeler



Kimler çevrimiçi

Bu forumu görüntüleyenler: Kayıtlı kullanıcı yok ve 0 misafir

cron