I released this ban script a long time ago however It has overcome many modifications and become quite more advanced than my old one. This script has the ability to ban accounts using either an ending date for the ban, or ban it permanently. Bans also can be managed/removed/added from this script as well.
Table:
Account_Tbl modifications:Code:USE [ACCOUNT_DBF] GO /****** Object: Table [dbo].[TBL_LOG_BLOCK_ACCOUNT] Script Date: 04/02/2012 23:43:51 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[TBL_LOG_BLOCK_ACCOUNT]( [account] [varchar](50) NOT NULL, [code1] [char](8) NOT NULL, [code2] [char](8) NOT NULL, [code3] [char](8) NOT NULL, [old_block_day] [char](8) NOT NULL, [old_web_day] [char](8) NOT NULL, [block_day] [char](8) NOT NULL, [web_day] [char](8) NOT NULL, [input_id] [char](20) NOT NULL, [input_day] [datetime] NOT NULL, [reason] [varchar](500) NOT NULL, [num] [nchar](10) NOT NULL, [r_web_day] [char](8) NULL, [r_block_day] [char](8) NULL, [r_input_day] [char](8) NULL, [r_reason] [varchar](500) NULL, [r_input_id] [varchar](30) NULL ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO ALTER TABLE [dbo].[TBL_LOG_BLOCK_ACCOUNT] ADD CONSTRAINT [DF_TBL_LOG_BLOCK_ACCOUNT_num] DEFAULT ((0)) FOR [num] GO
-Add a column called 'bantime' //This represents the amount of times the account has been banned
Account_Tbl_Detail modifications:
-Ensure all EndTime BlockTime and WebTime columns are set to '' //Make sure all the data for those columns is completely blank. [For new accounts edit your register page to render data for these columns blank]
Script:
Notice: My login panel is modified to show the reason for banning when they try to login on my website, that's what the reason field is intended for. You can do this yourself using general knowledgeCode:<?php ###################################################################### ###################################################################### #########################Created By TCxAlexsh######################### ###################################################################### ###################################################################### ?> <Html> <head> <script> function go(){ setTimeout(window.location='#bottom', 20000); } </script> </head> </html> <table width="100%" border="0"> <td align=\"left\" width=\"100%\"> <?php $actionx = $_GET['actionx']; if($actionx){}else{ header("Location: index.php?page=ban&actionx=noperm"); } $curdate = date("Ymd"); echo "<b><center><font color=white> Current Date: $curdate</font></b></center><br><BR><a href='index.php?page=ban&actionx=noperm'>Temporary Bans</a> | <a href='index.php?page=ban&actionx=perm'>Permanent</a><BR><br>"; if($actionx == 'noperm') { $checkUserNamex = mssql_query("SELECT * FROM ACCOUNT_DBF.dbo.TBL_LOG_BLOCK_ACCOUNT WHERE block_day >= '$curdate' AND web_day != 'PERM' order by input_day ASC"); } else { $checkUserNamex = mssql_query("SELECT * FROM ACCOUNT_DBF.dbo.TBL_LOG_BLOCK_ACCOUNT WHERE block_day >= '$curdate' AND web_day = 'PERM' order by input_day ASC"); } echo '<table width="100%" border="1" cellpadding="1" cellspacing="1"> <tr> <td height="23" bgcolor="#000000"><div align="center"><font size = "1"><font color="White"><b>Reason</div></td> <td height="23" bgcolor="#000000"><div align="center"><font size = "1"><font color="White"><b>Account</div></td> <td height="23" bgcolor="#000000"><div align="center"><font size = "1"><font color="White"><b>End Date</div></td> <td height="23" bgcolor="#000000"><div align="center"><b><font size = "1"><font color="white">Action</div></td> </tr>'; while ($dpox = mssql_fetch_array($checkUserNamex)) { $reason = $dpox['reason']; $datez = $dpox['input_day']; $txn = $dpox['account']; $statusz = $dpox['block_day']; $endz = $dpox['block_day']; echo '<tr>'; echo "<td bgcolor=\"#000000\" class=\"submit\" align=\"center\"><font color=\"White\">$reason</td>"; echo "<td bgcolor=\"#000000\" class=\"submit\" align=\"center\"><font color=\"White\" align=\"center\">$txn</td></font>"; echo "<td bgcolor=\"#000000\" class=\"submit\" align=\"center\">$statusz</td></font>"; if($actionx == 'noperm') { echo "<td bgcolor=\"#000000\" class=\"submit\" align=\"center\"><font color=\"White\"><a href='index.php?page=ban&actionx=noperm&dee=$txn&deeid=$endz'>Delete</a>"; } else { echo "<td bgcolor=\"#000000\" class=\"submit\" align=\"center\"><font color=\"White\"><a href='index.php?page=ban&actionx=perm&dee=$txn&deeid=$endz'>Delete</a>"; } echo '</tr></td>'; } $action = $_GET['action']; if($action == 'add') { echo "</table><table width=\"100%\" border=\"1\" cellpadding=\"0.3\" cellspacing=\"1\"><tr><td height=\"19\" bgcolor=\"#000000\">"; if(isset($_POST['submit'])) { $option = $_POST['option']; $accid = $_POST['accid']; $dateend = $_POST['date']; $reason = $_POST['reason']; $curdate = date("Ymd"); $checkUserNamex = mssql_query("SELECT TOP 1 * FROM ACCOUNT_DBF.dbo.TBL_LOG_BLOCK_ACCOUNT WHERE block_day >= '$curdate' AND ACCOUNT = '$accid' order by input_day ASC"); $checkperm = mssql_query("SELECT * FROM ACCOUNT_DBF.dbo.TBL_LOG_BLOCK_ACCOUNT WHERE block_day = 'PERM' AND ACCOUNT = '$accid'"); if(empty($accid) || empty($reason)) { echo "<center><Br><font color=red>Please fill in all fields.</font><br></center>"; } elseif(mssql_num_rows($checkUserNamex) > '0') { if(mssql_num_rows($checkperm) > '0') { echo"<center><Br><font color=red>A <font color=red><b>permanent </font></b>ban for this username already exists!</font><br></center>"; } else { echo"<center><Br><font color=red>A <font color=red><b>timed </font></b>ban for this username already exists!</font><br></center>"; } } else { if($option == 'Timed') { mssql_query("update account_tbl set bantime = (bantime + 1) where account = '$accid'"); mssql_query("insert into TBL_LOG_BLOCK_ACCOUNT (account, code1, code2, code3, old_block_day, old_web_day, block_day, web_day, input_id, input_day, reason) values ('$accid', '0', '0', '3', '', '', '$dateend', '$dateend', 'Ban', getdate(), '$reason')"); mssql_query("Update ACCOUNT_TBL_DETAIL set BlockTime = '$dateend' WHERE account = '$accid'"); if($actionx == 'noperm') { header("Location: index.php?page=ban&actionx=noperm"); } else { header("Location: index.php?page=ban&actionx=perm"); } } if($option == 'Perm') { mssql_query("UPDATE ACCOUNT_TBL SET bantime = (bantime + 1) WHERE account = '$accid'"); mssql_query("INSERT INTO TBL_LOG_BLOCK_ACCOUNT (account, code1, code2, code3, old_block_day, old_web_day, block_day, web_day, input_id, input_day, reason) values ('$accid', '0', '0', '3', '', '', 'PERM', 'PERM', 'Ban', getdate(), '$reason')"); mssql_query("Update ACCOUNT_TBL_DETAIL set BlockTime = 'NULL' WHERE account = '$accid'"); if($actionx == 'noperm') { header("Location: index.php?page=ban&actionx=noperm"); } else { header("Location: index.php?page=ban&actionx=perm"); } } } } if($actionx == 'noperm'){ echo' <form method="post"> <br /> <table border="0" valign="top"> </td> <tr> <td width="120px" align="right">Account ID:</td> <td><input type="text" name="accid" size="28" maxlength="16" class="Login" /></td> </tr> <tr> <td align="right">Type:</td><Td> <select name="option" id="amount" onchange="" size="1" style="width: 197px;"> <option value="Timed">Timed</option> </select></td> </tr> <tr> <td align="right">End Date:</td> <td><input type="text" name="date" size="28" class="Login"/> </tr> <tr> <td align="right">REASON:</td> <td><input type="text" name="reason" size="30" class="Login"/> </tr> </tr> <tr> <td colspan="2" align="center"> <input type="submit" name="submit" value="Ban" class="Login"/> </td> </tr> </td> </table> </form>'; } else { echo' <form method="post"> <br /> <table border="0" valign="top"> </td> <tr> <td width="120px" align="right">Account ID:</td> <td><input type="text" name="accid" size="28" maxlength="16" class="Login" /></td> </tr> <tr> <td width="120px" align="right">Type:</td> <td><select name="option" id="amount" onchange="" size="1" style="width: 197px;"> <option value="Perm">Permanent</option> </select></td> </tr> <tr> <td align="right">REASON:</td> <td><input type="text" name="reason" size="30" class="Login"/> </tr> </tr> <tr> <td colspan="2" align="center"> <input type="submit" name="submit" value="Ban" class="Login"/> </td> </tr> </td> </table> </form>'; } echo "<body onload='go()'>"; echo "</td>"; echo "</tr>"; echo "</table>"; if($actionx == 'noperm') { echo "<table width=\"100%\" border=\"1\" cellpadding=\"0.3\" cellspacing=\"1\"><tr><td height=\"19\" bgcolor=\"#000000\"><center><a href='index.php?page=ban&actionx=noperm'>[-]</a> Cancel Ban</center></td></tr></table>"; } else { echo "<table width=\"100%\" border=\"1\" cellpadding=\"0.3\" cellspacing=\"1\"><tr><td height=\"19\" bgcolor=\"#000000\"><center><a href='index.php?page=ban&action=perm'>[-]</a> Cancel Ban</center></td></tr></table>"; } } else { if($actionx == 'noperm') { echo "<table width=\"100%\" border=\"1\" cellpadding=\"0.3\" cellspacing=\"1\"><tr><td height=\"19\" bgcolor=\"#000000\"><center><a href='index.php?page=ban&actionx=noperm&action=add'>[+]</a> Add Ban</center></td></tr></table>"; } else { echo "<table width=\"100%\" border=\"1\" cellpadding=\"0.3\" cellspacing=\"1\"><tr><td height=\"19\" bgcolor=\"#000000\"><center><a href='index.php?page=ban&actionx=perm&action=add'>[+]</a> Add Ban</center></td></tr></table>"; } } $dee = $_GET['dee']; $deeid = $_GET['deeid']; if($dee != '') { if($deeid != '') { ECHO "<center><br><br>Are you sure you wish to remove the ban for $dee?<br><br></b>"; if($actionx == 'noperm') { echo "<body onload='go()'>"; ECHO "<a href='index.php?page=ban&actionx=noperm&ree=$dee&reeid=$deeid'>Yes</a> | <a href='index.php?page=ban&actionx=noperm'>No</a></center><br><br>"; } else { echo "<body onload='go()'>"; ECHO "<a href='index.php?page=ban&actionx=perm&ree=$dee&reeid=$deeid'>Yes</a> | <a href='index.php?page=ban&actionx=perm'>No</a></center><br><br>"; } } } $ree = $_GET['ree']; $reeid = $_GET['reeid']; if($ree != '') { if($reeid != '') { $checkif = mssql_query("SELECT * FROM ACCOUNT_DBF.dbo.TBL_LOG_BLOCK_ACCOUNT where account = '$ree' and block_day = '$reeid'"); if(mssql_num_rows($checkif) != '0') { mssql_query("Update ACCOUNT_TBL_DETAIL set BlockTime = '' WHERE account = '$ree'"); mssql_query("DELETE from TBL_LOG_BLOCK_ACCOUNT where account = '$ree'"); if($actionx == 'noperm') { header("Location: index.php?page=ban&actionx=noperm¬ice=successfull"); } else { header("Location: index.php?page=ban&actionx=perm¬ice=successfull"); } } else { if($actionx == 'noperm') { header("Location: index.php?page=ban&actionx=noperm¬ice=failed"); } else { header("Location: index.php?page=ban&actionx=perm¬ice=failed"); } } } } $notice = $_GET['notice']; if($notice != '') { echo "<center><b><br><br>Your attempt to remove this ban was $notice.</center></b><br><br>"; } ?> </table> <a name='bottom'> </a>
P.S. The 'End Date' for timed bans is the LAST DAY that the account will be banned, not the day that the ban will be removed.


Reply With Quote![Ban Script [Re-Release]](http://ragezone.com/hyper728.png)

