Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev
Reply
  #1  
Old 26th October 2009, 16:46
irfan's Avatar
irfan irfan is offline
Senior Member
 
Join Date: Jun 2009
United Kingdom
Posts: 67
Default IP BAN MOD -using tbdev 1.08.08 source
hello people im using this mod Board Message
for ip ban when u login unsuccesfully 6 times it works but it doesnt clear the unscuessful attempts in the db once logged in successffully by a user. please help the attached files are here:

PHP Code:
<?
require "include/bittorrent.php";
dbconn(false);
loggedinorreturn();
if (
get_user_class() < UC_ADMINISTRATOR)
stderr("Sorry""Access denied.");
$action = (isset($_GET['action']) ? $_GET['action'] : 'showlist');
$id = (isset($_GET['id']) ? $_GET['id'] : '');
function 
check ($id) {    
    if (!
is_valid_id($id))
        return 
stderr("Error","Invalid ID");
    else
        return 
true;
}
function 
safe_query ($query,$id) {
    
$query sprintf("$query WHERE id ='%s'",
    
mysql_real_escape_string($id));
    
$result mysql_query($query);
    if (!
$result)
        return 
sqlerr(__FILE__,__LINE__);
    else
        
redirect('maxlogin.php');
}
function 
redirect($url)
{
    if(!
headers_sent())
         
header("Location : $url");
    else
        echo 
"<script language=\"JavaScript\">window.location.href = '$url';</script>";
    exit;

if (
$action == 'showlist') {
stdhead ("Max. Login Attemps - Show List");
print(
"<table border=1 cellspacing=0 cellpadding=5 width=737>\n");
$res mysql_query("SELECT * FROM  loginattempts ORDER BY added DESC") or sqlerr(__FILE__,__LINE__);
if (
mysql_num_rows($res) == 0)
      print(
"<tr><td colspan=2><b>Nothing found</b></td></tr>\n");
else
{  
  print(
"<tr><td class=colhead>ID</td><td class=colhead align=left>Ip Address</td><td class=colhead align=left>Action Time</td>".
    
"<td class=colhead align=left>Attempts</td><td class=colhead align=left>Status</td></tr>\n");

  while (
$arr mysql_fetch_assoc($res))
  {
      
$r2 mysql_query("SELECT id,username FROM users WHERE ip=".sqlesc($arr[ip])) or sqlerr(__FILE__,__LINE__);
      
$a2 mysql_fetch_assoc($r2);    
       print(
"<tr><td align=>$arr[id]</td><td align=left>$arr[ip] " . ($a2[id] ? "<a href=userdetails.php?id=$a2[id]>" "" ) . " " . ( $a2[username] ? "($a2[username])</a>" "" ) . "</td><td align=left>$arr[added]</td><td align=left>$arr[attempts]</td><td align=left>".($arr[banned] == "yes" "<font color=red><b>banned</b></font> <a href=maxlogin.php?action=unban&id=$arr[id]><font color=green>[<b>unban</b>]</font></a>" "<font color=green><b>not banned</b></font> <a href=maxlogin.php?action=ban&id=$arr[id]><font color=red>[<b>ban</b>]</font></a>")."  <a OnClick=\"return confirm('Are you wish to delete this attempt?');\" href=maxlogin.php?action=delete&id=$arr[id]>[<b>delete</b>]</a></td></tr>\n");
  }
  
}
print(
"</table>\n");
}elseif (
$action == 'ban') {
    
check($id);
    
stdhead ("Max. Login Attemps - BAN");    
    
safe_query("UPDATE loginattempts SET banned = 'yes'",$id);
}elseif (
$action == 'unban') {
    
check($id);
    
stdhead ("Max. Login Attemps - UNBAN");
    
safe_query("UPDATE loginattempts SET banned = 'no'",$id);
}elseif (
$action == 'delete') {
    
check($id);
    
stdhead ("Max. Login Attemps - DELETE");
    
safe_query("DELETE FROM loginattempts",$id);
    
}else
    
stderr("Error","Invalid Action");
Reply With Quote
The Following User Says Thank You to irfan For This Useful Post:
nicukent (22nd February 2013)
Reply

Tags
ban , ip , mod , source , tbdev

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
TBDev v2.0 Yuna source bit4you Yuna Scatari Edition (YSE) 7 12th June 2010 19:48
Modded TBDEV source on it's way! Strikey Community Cafe 8 18th December 2009 00:41
TBDev source like this... evaldas40 TBDev 2 25th October 2009 14:58
Bug Free TBDev Source DuSteR TBDev 2 28th October 2008 11:56



All times are GMT +2. The time now is 16:27. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.