09 Banned Emails

Started by Mindless, February 07, 2013, 08:59:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mindless

All credits to xOr the original creator of this mod, updated for 09,  Xhtml valid, language support added.

First run this sql

Code (sql) Select
CREATE TABLE IF NOT EXISTS `bannedemails` (
`id` int(10) unsigned NOT NULL auto_increment,
`added` int(11) NOT NULL,
`addedby` int(10) unsigned NOT NULL default '0',
`comment` varchar(255) collate utf8_unicode_ci NOT NULL,
`email` varchar(255) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `bannedemails`
--

INSERT INTO `bannedemails` (`id`, `added`, `addedby`, `comment`, `email`) VALUES
(159, 1282299331, 1, 'Fake provider', '*@emailias.com'),
(158, 1282299331, 1, 'Fake provider', '*@e4ward.com'),
(157, 1282299331, 1, 'Fake provider', '*@dumpmail.de'),
(156, 1282299331, 1, 'Fake provider', '*@dontreg.com'),
(155, 1282299331, 1, 'Fake provider', '*@disposeamail.com'),
(154, 1282299331, 1, 'Fake provider', '*@antispam24.de'),
(153, 1282299331, 1, 'Fake provider', '*@trash-mail.de'),
(152, 1282299331, 1, 'Fake provider', '*@spambog.de'),
(151, 1282299331, 1, 'Fake provider', '*@spambog.com'),
(150, 1282299331, 1, 'Fake provider', '*@discardmail.com'),
(149, 1282299331, 1, 'Fake provider', '*@discardmail.de'),
(148, 1282299331, 1, 'Fake provider', '*@mailinator.com'),
(147, 1282299331, 1, 'Fake provider', '*@wuzup.net'),
(146, 1282299331, 1, 'Fake provider', '*@junkmail.com'),
(145, 1282299331, 1, 'Fake provider', '*@clarkgriswald.net'),
(144, 1282299331, 1, 'Fake provider', '*@2prong.com'),
(143, 1282299331, 1, 'Fake provider', '*@jrwilcox.com'),
(142, 1282299331, 1, 'Fake provider', '*@10minutemail.com'),
(141, 1282299331, 1, 'Fake provider', '*@pookmail.com'),
(140, 1282299331, 1, 'Fake provider', '*@golfilla.info'),
(139, 1282299331, 1, 'Fake provider', '*@afrobacon.com'),
(138, 1282299331, 1, 'Fake provider', '*@senseless-entertainment.com'),
(137, 1282299331, 1, 'Fake provider', '*@put2.net'),
(136, 1282299331, 1, 'Fake provider', '*@temporaryinbox.com'),
(135, 1282299331, 1, 'Fake provider', '*@slaskpost.se'),
(161, 1282299331, 1, 'Fake provider', '*@haltospam.com'),
(162, 1282299331, 1, 'Fake provider', '*@h8s.org'),
(163, 1282299331, 1, 'Fake provider', '*@ipoo.org'),
(164, 1282299331, 1, 'Fake provider', '*@oopi.org'),
(165, 1282299331, 1, 'Fake provider', '*@poofy.org'),
(166, 1282299331, 1, 'Fake provider', '*@jetable.org'),
(167, 1282299331, 1, 'Fake provider', '*@kasmail.com'),
(168, 1282299331, 1, 'Fake provider', '*@mail-filter.com'),
(169, 1282299331, 1, 'Fake provider', '*@maileater.com'),
(170, 1282299331, 1, 'Fake provider', '*@mailexpire.com'),
(171, 1282299331, 1, 'Fake provider', '*@mailnull.com'),
(172, 1282299331, 1, 'Fake provider', '*@mailshell.com'),
(173, 1282299331, 1, 'Fake provider', '*@mymailoasis.com'),
(174, 1282299331, 1, 'Fake provider', '*@mytrashmail.com'),
(175, 1282299331, 1, 'Fake provider', '*@mytrashmail.net'),
(176, 1282299331, 1, 'Fake provider', '*@shortmail.net'),
(177, 1282299331, 1, 'Fake provider', '*@sneakemail.com'),
(178, 1282299331, 1, 'Fake provider', '*@sofort-mail.de'),
(179, 1282299331, 1, 'Fake provider', '*@spamcon.org'),
(180, 1282299331, 1, 'Fake provider', '*@spamday.com'),
(210, 1282299331, 1, 'fake provider', '*@spamex.com'),
(209, 1282299307, 1, 'fake provider', '*@spamgourmet.com'),
(208, 1282299289, 1, 'fake provider', '*@spamhole.com'),
(184, 1282299331, 1, 'Fake provider', '*@spammotel.com'),
(185, 1282299331, 1, 'Fake provider', '*@tempemail.net'),
(186, 1282299331, 1, 'Fake provider', '*@tempinbox.com'),
(187, 1282299331, 1, 'Fake provider', '*@throwaway.de'),
(188, 1282299331, 1, 'Fake provider', '*@woodyland.org');


open file takesignup.php and find

Code (php) Select
function validusername($username)
{
global $lang;

if ($username == "")
return false;

$namelength = strlen($username);

if( ($namelength < 3) OR ($namelength > 32) )
{
stderr($lang['takesignup_user_error'], $lang['takesignup_username_length']);
}
// The following characters are allowed in user names
$allowedchars = $lang['takesignup_allowed_chars'];

for ($i = 0; $i < $namelength; ++$i)
{
if (strpos($allowedchars, $username[$i]) === false)
return false;
}

return true;
}


after it add

Code (php) Select
function check_banned_emails ($email) {
global $lang;
$expl = explode("@", $email);
$wildemail = "*@".$expl[1];
/* Ban emails by x0r @tbdev.net */
$res = mysql_query("SELECT id, comment FROM bannedemails WHERE email = ".sqlesc($email)." OR email = ".sqlesc($wildemail)."") or sqlerr(__FILE__, __LINE__);
if ($arr = mysql_fetch_assoc($res))
stderr("{$lang['takesignup_user_error']}","{$lang['takesignup_bannedmail']}$arr[comment]", false);
}


now find

Code (php) Select
$wanthintanswer = md5($hintanswer);

bellow this add

Code (php) Select
check_banned_emails($email);

open file lang\en\lang_takesignup.php and add

Code (php) Select
'takesignup_bannedmail' =>"This email address is banned!<br /><br /><strong>Reason</strong>:"

open file admin.php and add

Code (php) Select
'bannedemails' => 'bannedemails',

open file admin\index.php and add

Code (php) Select
<span class='btn'><a href='admin.php?action=bannedemails'>{$lang['index_bannedemails']}</a></span>

open file lang\en\lang_ad_index.php and add

Code (php) Select
'index_bannedemails' => 'Banned Emails',

create a new file with the following contents named bannedemails.php and upload to admin folder

Code (php) Select
<?php
if ( ! defined'IN_TBDEV_ADMIN' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly.";
exit();
}

require_once 
"include/html_functions.php";
require_once 
"include/bbcode_functions.php";
require_once 
"include/pager_functions.php";
$lang array_merge$langload_language('ad_banemail') );
if (
get_user_class() < UC_ADMINISTRATOR)
stderr("Error""Access Denied!");
/* Ban emails by x0r @tbdev.net */
$HTMLOUT ='';
$remove = isset($_GET['remove']) ? $_GET['remove'] : '';
if (
$remove) {
mysql_query("DELETE FROM bannedemails WHERE id = '$remove'") or sqlerr(__FILE____LINE__);
write_log("{$lang['ad_banemail_log1']} $remove {$lang['ad_banemail_log2']} $CURUSER[username]");
}
if (
$_SERVER["REQUEST_METHOD"] == "POST") {
$email trim($_POST["email"]);
$comment trim($_POST["comment"]);
if (!
$email || !$comment)
stderr("{$lang['ad_banemail_error']}""{$lang['ad_banemail_missing']}");
mysql_query("INSERT INTO bannedemails (added, addedby, comment, email) VALUES(" sqlesc(time()) . ", $CURUSER[id], " sqlesc($comment) . ", " sqlesc($email) . ")") or sqlerr(__FILE____LINE__);
header("Location: $_SERVER[REQUEST_URI]");
die;
}

ob_start("ob_gzhandler");
$HTMLOUT .=begin_frame("{$lang['ad_banemail_add']}",true);
$HTMLOUT .="<form method=\"post\" action=\"admin.php?action=bannedemails\">
<table border='1' cellspacing='0' cellpadding='5'>
<tr><td class='rowhead'>
{$lang['ad_banemail_email']}</td><td><input type=\"text\" name=\"email\" size=\"40\"/></td></tr>
<tr><td class='rowhead'align='left'>
{$lang['ad_banemail_comment']}</td><td><input type=\"text\" name=\"comment\" size=\"40\"/></td></tr>
<tr><td colspan='2'>
{$lang['ad_banemail_info']}</td></tr>
<tr><td colspan='2' align='center'><input type=\"submit\" value=\"
{$lang['ad_banemail_ok']}\" class=\"btn\"/></td></tr>
</table>\n</form>\n"
;
$HTMLOUT .=end_frame();
$count1 get_row_count('bannedemails');
$perpage 15;
$pager pager($perpage$count1'admin.php?action=bannedemails&amp;');
$res mysql_query("SELECT * FROM bannedemails ORDER BY added DESC ".$pager['limit']."") or sqlerr(__FILE____LINE__);
$HTMLOUT .=begin_frame("{$lang['ad_banemail_current']}",true);
if (
$count1 $perpage)
$HTMLOUT .= $pager['pagertop'];
if (
mysql_num_rows($res) == 0)
$HTMLOUT .="<p align='center'><b>{$lang['ad_banemail_nothing']}</b></p>\n";
else {
$HTMLOUT .="<table border='1' cellspacing='0' cellpadding='5'>\n";
$HTMLOUT .="<tr><td class='colhead'>{$lang['ad_banemail_add1']}</td><td class='colhead' align='left'>{$lang['ad_banemail_email']}</td>" "<td class='colhead' align='left'>{$lang['ad_banemail_by']}</td><td class='colhead' align='left'>{$lang['ad_banemail_comment']}</td><td class='colhead'>{$lang['ad_banemail_remove']}</td></tr>\n";
while (
$arr mysql_fetch_assoc($res)) {
$r2 mysql_query("SELECT username FROM users WHERE id = $arr[addedby]") or sqlerr(__FILE____LINE__);
$a2 mysql_fetch_assoc($r2);
$HTMLOUT .="<tr><td align='left'>".get_date($arr['added'], '')."</td><td align='left'>$arr[email]</td><td align='left'><a href='userdetails.php?id=$arr[addedby]'>$a2[username]"</a></td><td align='left'>$arr[comment]</td><td align='left'><a href='bannedemails.php?remove=$arr[id]'>{$lang['ad_banemail_remove1']}</a></td></tr>\n";
}
$HTMLOUT .="</table>\n";
}
if (
$count1 $perpage)
$HTMLOUT .= $pager['pagerbottom'];
$HTMLOUT .=end_frame();
/////////////////////// HTML OUTPUT //////////////////////////////
print stdhead("{$lang['ad_banemail_head']}").$HTMLOUT.stdfoot();
?>


create a new file called lang_ad_banemails.php and upload to your lang\en folder

Code (php) Select
<?php

$lang 
= array(


'ad_banemail_head' => "Banned Emails",
'ad_banemail_log1' => "Email ban ",
'ad_banemail_log2' => "was removed by",
'ad_banemail_error' => "Error !",
'ad_banemail_missing' => "Missing Form Data.",
'ad_banemail_add' => "Add Ban",
'ad_banemail_email' => "Email",
'ad_banemail_comment' => "Comment",
'ad_banemail_info' => "Use *@email.com as wildcard for domain.",
'ad_banemail_ok' => "Ok",
'ad_banemail_current' => "Current Banned Emails",
'ad_banemail_nothing' => "Nothing Found !",
'ad_banemail_add1' => "Added",
'ad_banemail_by' => "By",
'ad_banemail_remove' => "Remove ?",
'ad_banemail_remove1' => "Remove it",
);

?>


and that should be it any problems will try my best to rectify .