Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Banned IP 2.08
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2.08 Mods Completed

Unknown User
2013-09-09 00:41:42
Sql

ALTER TABLE `bans` ADD UNIQUE `first_last1` ( `first` , `last` );

put this code admincp.php

#===========================#
#        IP BANNED          #
#===========================#
if ($action == "ipbans") {
   stdhead("Banned IPs");
   navmenu();

if ($do == "del") {
   $delids = implode(", ", array_map("intval", $_POST["delids"]));
   $res = SQL_Query_exec("SELECT * FROM bans WHERE id IN ($delids)");
while ($row = mysql_fetch_assoc($res)) {
   SQL_Query_exec("DELETE FROM bans WHERE id=$row[id]");
   write_log("IP Ban (".long2ip($row["first"])." - ".long2ip($row["last"]).") was removed by $CURUSER[id] ($CURUSER[username])");
}
   show_error_msg("Success", "Ban(s) deleted.", 0);
}

if ($do == "add") {
   $first = trim($_POST["first"]);
   $last = trim($_POST["last"]);
   $comment = trim($_POST["comment"]);
       
if ($first == "" || $last == "" || $comment == "")
   show_error_msg("Error", "Missing form data. Go back and try again", 1);
   $first = ip2long($first);
   $last = ip2long($last);
       
if ($first == -1 || $last == -1)
   show_error_msg("Error", "Bad IP address.");
   $comment = sqlesc($comment);
   $added = sqlesc(get_date_time());
   SQL_Query_exec("INSERT INTO bans (added, addedby, first, last, comment) VALUES($added, $CURUSER[id], $first, $last, $comment)");
   switch (mysql_errno()) {
   case 1062:
   show_error_msg("Error", "Duplicate ban.", 0);
   break;
   case 0:
   show_error_msg("Success", "Ban added.", 0);
   break;
   default:
   show_error_msg("Error", "Database error: ".htmlspecialchars(mysql_error()), 0);
}
}

   begin_frame("Banned IPs", "center");
   echo "<p align="justify">This page allows you to prevent individual users or groups of users from accessing your tracker by placing a block on their IP or IP range.<BR>
   If you wish to temporarily disable an account, but still wish a user to be able to view your tracker, you can use the 'Disable Account' option which is found in the user's profile page.</p><BR>";
   $count = get_row_count("bans");
   
if ($count == 0)
   print("<b>No Bans Found</b><br />n");
else {
   list($pagertop, $pagerbottom, $limit) = pager(50, $count, "admincp.php?action=ipbans&"); // 50 per page
   echo $pagertop;
   echo "<form action='admincp.php?action=ipbans&do=del' method='POST'><table border=1 cellspacing=0 cellpadding=5 align=center class=ttable_headinner>
<tr>
   <td class=ttable_head>".DATE_ADDED."</td>
   <td class=table_head align=left>First IP</td>
   <td class=ttable_head align=left>Last IP</td>
   <td class=ttable_head align=left>".ADDED_BY."</td>
   <td class=ttable_head align=left>Comment</td>
   <td class=ttable_head>Del?</td>
</tr>";

   $res = SQL_Query_exec("SELECT bans.*, users.username FROM bans LEFT JOIN users ON bans.addedby=users.id ORDER BY added $limit");
while ($arr = mysql_fetch_assoc($res)) {
   $arr["first"] = long2ip($arr["first"]);
   $arr["last"] = long2ip($arr["last"]);
echo "<tr>
<td align=center class=ttable_col1>".date('d/m/Y<BR>H:i:s', utc_to_tz_time($arr["added"]))."</td>
<td align=center class=ttable_col2>$arr[first]</td>
<td align=center class=ttable_col1>$arr[last]</td>
<td align=center class=ttable_col2><a href='account-details.php?id=$arr[addedby]'>$arr[username]</a></td>
<td align=center class=ttable_col1>$arr[comment]</td>
<td align=center class=ttable_col2><input type='checkbox' name='delids[]' value='$arr[id]'></td>
</tr>";
}
   echo "</table><BR><input type='submit' value='Delete Checked'>&nbsp;<input type='button' onclick='this.value=check(form)' value='Check All'></form>";
   echo $pagerbottom;
}
   echo "<br><br>";
   
begin_frame("Add Ban", "center");
   
   print("<table border=1 cellspacing=0 cellpadding=5>n");
   print("<form method=post action=admincp.php?action=ipbans&do=add>n");
   print("<tr><td class=rowhead>First IP</td><td><input type=text name=first size=40></td>n");
   print("<tr><td class=rowhead>Last IP</td><td><input type=text name=last size=40></td>n");
   print("<tr><td class=rowhead>Comment</td><td><input type=text name=comment size=40></td>n");
   print("<tr><td colspan=2><input type=submit value='Okay' class=btn></td></tr>n");
   print("</form>n</table>n");
   
end_frame();
end_frame();
stdfoot();
}

#================================#
#    End IP BANNED               #
#================================#
and this code

<td align="center"><a href="admincp.php?action=ipbans"><img src="images/admin/banned_ip.png" border="0" width="32" height="32" alt="" /><br /><?php echo T_("BANNED_IPs"); ?><br /></a></td>


image



banned_ip.png
banned_ip.png
Unknown User
2013-09-19 18:15:28
Will try this, thanks for the share!
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728