lucky3809 Posted April 14, 2011 Posted April 14, 2011 (edited) This mod allows you to ignore mail from users... If you may see something in the code that you do not want in it please feel free to delete it...Dont complain about it, because this is a FREE mod... It's been posted before, but none have worked... SQLS: CREATE TABLE `ignorelist` ( `ig_ID` int(11) NOT NULL auto_increment, `ig_ADDER` int(11) NOT NULL default '0', `ig_ADDED` int(11) NOT NULL default '0', PRIMARY KEY (`ig_ID`) ) ENGINE=MyISAM ; Open up mailbox.php Find:<a href="mailbox.php?action=delete&ID='.$r['mail_id'].'">Delete</a> <br /> Under it add: [<a href="ignore.php">Ignore</a>]<br /> Find under function mail_send(): You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Add Under it: $ig=$db->query("SELECT ig_ADDER FROM ignorelist WHERE ig_ADDED=".abs(@intval($_SESSION['userid']))." AND ig_ADDER=$to")or die(mysql_error()); $r=$db->fetch_row($ig); if($r['ig_ADDER']) { die('<h1> Sending Mail Error...</h1><br /> This person has chosen to ignore mails from you.<br /> <hr style="border-bottom: solid #d6d6d6 1px;" width="400"> <a href="mailbox.php">Back</a>'); } Make a new file call it ignore.php And add: <?php include(DIRNAME(__FILE__).'/globals.php'); switch($_GET['action']) { case "add":add_ignore();break; case "remove":remove_ignore();break; default:ignore_list();break; } function ignore_list() { global $db,$ir,$c,$userid; echo '<br/> <h2>Ignore List</h2><br /><br /> <a href="ignore.php?action=add">Ignore a user?</a><br /><br /> <table width="60%"><tr bgcolor="grey"> <td style="width: 35px;"><font color="white">ID</font></td> <td style="width: 100px;"><font color="white">Name</font></td> <td style="width: 50px;"><font color="white"><center>Remove</center></font></td></tr>'; $q=$db->query("SELECT fl.*,u.* FROM ignorelist fl LEFT JOIN users u ON fl.ig_ADDED=u.userid WHERE fl.ig_ADDER=".abs(@intval($_SESSION['userid']))." ORDER BY u.username ASC")or die(mysql_error()); while($r=$db->fetch_row($q)) { $bgcolor = ($bgcolor == "#ececec") ? "#ffffff" : "#ececec"; echo '<tr style="background-color: '.$bgcolor .'"><td>'.$r['userid'].'</td> <td><a href="viewuser.php?u='.abs(@intval($r['userid'])).'">'.$r['username'].'</a></td> <td><center><a href="ignore.php?action=remove&f='.abs(@intval($r['ig_ID'])).'">Remove</a></center></td></tr>'; } echo '</table><br/></div>'; } function add_ignore() { global $db,$ir,$c,$userid; $_POST['ID']= (isset($_POST['ID']) && ctype_digit($_POST['ID'])) ? $_POST['ID'] : ''; if($_POST['ID']) { $qc=$db->query("SELECT ig_ID,ig_ADDER,ig_ADDED FROM ignorelist WHERE ig_ADDER=".abs(@intval($_SESSION['userid']))." AND ig_ADDED=".abs(@intval($_POST['ID']))."")or die(mysql_error()); $q=$db->query("SELECT userid,username FROM users WHERE userid=".abs(@intval($_POST['ID']))."")or die(mysql_error()); if($db->num_rows($qc)) { echo '<h2>Ignoring Mail...</h2><br /><br /> You cannot add the same person twice. <hr style="border-bottom: solid #d6d6d6 1px;" width="400"> <a href="ignore.php">Back</a>'; } else if($userid==$_POST['ID']) { echo '<h2>Ignoring Mail...</h2><br /><br /> You cannot add yourself. <hr style="border-bottom: solid #d6d6d6 1px;" width="400"> <a href="ignore.php">Back</a>'; } else if($db->num_rows($q)==0) { echo '<h2>Ignoring Mail...</h2><br /><br /> The id you entered does not exist. <hr style="border-bottom: solid #d6d6d6 1px;" width="400"> <a href="ignore.php">Back</a>'; } else { $db->query("INSERT INTO ignorelist VALUES('', ".abs(@intval($_SESSION['userid'])).",".abs(@intval($_POST['ID'])).")")or die(mysql_error()); $r=$db->fetch_row($q); echo '<h2>Ignoring Mail...</h2><br /><br /> '.$r['username'].' was added to your ignore list. <hr style="border-bottom: solid #d6d6d6 1px;" width="400"> <a href="ignore.php">Back</a>'; } } else { echo '<br /> <h2>Ignore Mail</h2><br /><br /> <form action="ignore.php?action=add" method="post"> Player ID: <input type="text" name="ID" value="" /><br /> <input type="submit" value="Ignore" /></form>'; } } function remove_ignore() { global $db,$ir,$c,$userid; $q=$db->query("SELECT ig_ID,ig_ADDER,ig_ADDED FROM ignorelist WHERE ig_ID=".abs(@intval($_GET['f']))." AND ig_ADDER=".abs(@intval($_SESSION['userid']))."")or die(mysql_error()); if($db->num_rows($q) == 0) { die ('<h2>Removing Ignore...</h2><br /><br /> This player is not on your ignore list. <hr style="border-bottom: solid #d6d6d6 1px;" width="400"> <a href="ignore.php">Back</a>'); } $r=$db->fetch_row($q); $db->query("DELETE FROM ignorelist WHERE ig_ID=".abs(@intval($_GET['f']))." AND ig_ADDER=".abs(@intval($_SESSION['userid']))."")or die(mysql_error()); echo '<h2>Removing Ignore...</h2><br /><br /> Player has been successfully removed from ignore list. <hr style="border-bottom: solid #d6d6d6 1px;" width="400"> <a href="ignore.php">Back</a>'; } $h->endpage(); ?> That should be it enjoy... Note to mods:If your wondering why i didnt use the php bbcode its because it was adding <br /> on every single line... Edited April 14, 2011 by lucky3809 Quote
rulerofzu Posted April 14, 2011 Posted April 14, 2011 Read this im sure its going to help you in the future with your code. http://php.net/manual/en/language.operators.errorcontrol.php Well done and if your using chrome the br tags appear but its not there for other browsers! Quote
lucky3809 Posted April 15, 2011 Author Posted April 15, 2011 thank you both... I use firefox 4.. could be the reason... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.