So,
habe es jetzt tatsächlich geschafft, eine Flood Control in den
Easy Contact Form - Mod zu integrieren, sodass man innerhalb eines frei festlegbaren Zeitraumes nur
eine Kontaktabfrage abschicken kann.
Wichtig:
- Vor Eingriffen in die Datenbank unbedingt ein Backup anfertigen.
- Meine Abänderung von AmShaegars Code setzt voraus, dass cbacks CrackerTracker (siehe meine Signatur) installiert ist.
1. Führe in phpMyAdmin folgendes SQL-Query aus:
Code: Alles auswählen
INSERT INTO phpbb_cracktrack (name, secval) VALUES ('lastcontact', '0');
2. Befolge die unten stehenden Anweisungen:
Code: Alles auswählen
#
#-----[ OPEN ]------------------------------------------
#
lang_contact.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all, Folks!
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['Floodschutz'] = 'Über dieses Kontaktformular kann aus Sicherheitsgründen nur alle 30 Sekunden eine E-Mail abgeschickt werden. Bitte warte noch %s Sekunden, bis Du das Kontaktformular benutzen kannst.';
#
#-----[ OPEN ]------------------------------------------
#
contact_form.php
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//
// CBACK CrackerTracker Flood Protection
//
$lcontimestamp = '';
$sql = "SELECT secval FROM " . CRACKTRACK . " WHERE name = 'lastcontact'";
if( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$lcontimestamp = $row['secval'];
if ( $lcontimestamp >= time() )
{
$waittime = 0;
$waittime = $lcontimestamp - time();
$waitmsg = '';
$waitmsg = sprintf($lang['Floodschutz'],$waittime);
message_die(GENERAL_MESSAGE, $waitmsg);
}
#
#-----[ FIND ]------------------------------------------
#
// Get users IP addy for mail header
$user_ip = get_ip();
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Insert into tables by AmShaegar
$forum_id = '61'; // Gewünschtes Forum auswählen!!!
$poster_id = $userdata['user_id'];
$post_time = time();
$poster_ip = $user_ip;
$post_username = $userdata['session_logged_in'] ? $userdata['username'] : $from_name;
$enable_bbcode = '0';
$enable_html = '0';
$enable_smilies = '1';
$enable_sig = '0';
$topic_title = $enquiry;
$topic_poster = $poster_id;
$topic_time = $post_time;
$INS_topics = "INSERT INTO ".TOPICS_TABLE." (forum_id, topic_title, topic_poster, topic_time) VALUES ('$forum_id', '$topic_title', '$topic_poster', '$topic_time')";
mysql_query($INS_topics) or die("Leider ist ein Fehler aufgetreten. Die E-Mail wurde nicht verschickt.");
$SEL_t = "SELECT topic_id FROM ".TOPICS_TABLE." WHERE topic_time LIKE '$topic_time'";
$QUE_t = mysql_query($SEL_t);
$res_t = mysql_fetch_object($QUE_t);
$topic_id = $res_t->topic_id;
$INS_posts = "INSERT INTO ".POSTS_TABLE." (topic_id, forum_id, poster_id, post_time, poster_ip, post_username, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ('$topic_id', '$forum_id', '$poster_id', '$post_time', '$poster_ip', '$post_username', '$enable_bbcode', '$enable_html', '$enable_smilies', '$enable_sig')";
mysql_query($INS_posts) or die("Leider ist ein Fehler aufgetreten. Die E-Mail wurde nicht verschickt.");
$bbcode_uid = '1234567890';
$post_subject = $enquiry;
$post_text = addslashes($message);
$SEL = "SELECT post_id FROM ".POSTS_TABLE." ORDER BY post_id DESC LIMIT 1";
$QUE = mysql_query($SEL);
$res = mysql_fetch_object($QUE);
$post_id = $res->post_id;
$UPD_topics = "UPDATE ".TOPICS_TABLE." SET topic_first_post_id = '$post_id', topic_last_post_id = '$post_id' WHERE topic_time LIKE '$topic_time'";
mysql_query($UPD_topics) or die("Leider ist ein Fehler aufgetreten. Die E-Mail wurde nicht verschickt.");
$INS_posts_text = "INSERT INTO ".POSTS_TEXT_TABLE." (post_id, bbcode_uid, post_subject, post_text) VALUES ('$post_id', '$bbcode_uid', '$post_subject', '$post_text')";
mysql_query($INS_posts_text) or die("Leider ist ein Fehler aufgetreten. Die E-Mail wurde nicht verschickt.");
$SEL_f = "SELECT forum_posts, forum_topics FROM ".FORUMS_TABLE." WHERE forum_id LIKE '$forum_id'";
$QUE_f = mysql_query($SEL_f);
$res_f = mysql_fetch_object($QUE_f);
$forum_posts = $res_f->forum_posts + 1;
$forum_topics = $res_f->forum_topics + 1;
$forum_last_post_id = $post_id;
$UPD_forums = "UPDATE ".FORUMS_TABLE." SET forum_posts = '$forum_posts', forum_topics = '$forum_topics', forum_last_post_id = '$forum_last_post_id' WHERE forum_id = '$forum_id'";
$ergebnis = mysql_query($UPD_forums);
if ($ergebnis) {
$stime = time() + 30; //hier wird das Flood-Intervall in Sekunden festgelegt
$sql = "UPDATE " . CRACKTRACK . " SET secval = " . $stime . " WHERE name = 'lastcontact'";
$db->sql_query($sql);
echo'<meta http-equiv="refresh" content="6;url=' . append_sid($phpbb_root_path . "index.$phpEx") . '">';
message_die(GENERAL_MESSAGE, $message = $lang['ESuccessfully'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid($phpbb_root_path . "index.$phpEx") . '">', '</a>') . '');
} else {
message_die(GENERAL_ERROR, $lang['EMain_error']);
exit;
}
// End of Insert into tables by AmShaegar
Herzlichen Dank noch einmal an AmShaegar & cback!
LG, IPB_Flüchtling