getLine("SELECT * FROM bans WHERE ip = '$addip'"); if($checker != FALSE) { header("location: $PHP_SELF?n=modules/ban&i=40"); exit; } //----------------------------------------------------------------- // Write log //----------------------------------------------------------------- $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc3'].' bans the ip -> \''.$addip.'\'','date' => ''.time().'')); //----------------------------------------------------------------- // Write the ip in the table //----------------------------------------------------------------- $db->insertRow("bans",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','banned_id' => NULL,'banned_user' => NULL,'ip' => ''.$addip.'','date' => ''.time().'')); //----------------------------------------------------------------- // Redirect when finished + trick //----------------------------------------------------------------- $rows_per_page = $config['nav_bans']; $temp = $db->getTable("SELECT * FROM bans"); $numrows = count($temp); $lastpage = ceil($numrows/$rows_per_page); header("location: $PHP_SELF?n=modules/ban&s=1&t=ASC&p=$lastpage&i=41"); break; //----------------------------------------------------------------- // Unblock ip //----------------------------------------------------------------- case 2: //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- $checker = $db->getLine("SELECT * FROM bans WHERE id = '$d'"); $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc'].' bans the ip -> \''.$checker['ip'].'\'','date' => ''.time().'')); //----------------------------------------------------------------- // Delete from list //----------------------------------------------------------------- $db->deleteRow("bans","id = '$d'"); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/ban&s=$s&t=$t&p=$p&i=42"); break; //----------------------------------------------------------------- // Unban user //----------------------------------------------------------------- case 3: //----------------------------------------------------------------- // Write Log //----------------------------------------------------------------- $checker = $db->getLine("SELECT * FROM bans WHERE banned_id = '$d'"); $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc'].' bans the user -> \''.$checker['banned_user'].'\'','date' => ''.time().'')); $db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc2'].' users the user -> \''.$checker['banned_user'].'\' to status = \'ready\'','date' => ''.time().'')); //----------------------------------------------------------------- // Delete from list //----------------------------------------------------------------- $db->deleteRow("bans","banned_id = '$d'"); $db->updateRow("users",array('status' => 'ready'),"id = $d"); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/ban&s=$s&t=$t&p=$p&i=43"); break; //----------------------------------------------------------------- // Show list + form //----------------------------------------------------------------- default: //----------------------------------------------------------------- // Navigation Stuff //----------------------------------------------------------------- $rows_per_page = $config['nav_bans']; $temp = $db->getTable("SELECT * FROM bans"); $numrows = count($temp); $lastpage = ceil($numrows/$rows_per_page); $p = (int)$p; if ($p < 1) $p = 1; elseif ($p > $lastpage) $p = $lastpage; if($numrows != FALSE) $limit = 'LIMIT ' .($p - 1) * $rows_per_page .',' .$rows_per_page; else $limit = NULL; //----------------------------------------------------------------- // Sorting Stuff //----------------------------------------------------------------- if(!isset($s)) $s = 'id'; // Default value if(!isset($t)) $t = 'ASC'; // Default value $sname1 = "id"; $sname2 = "ip"; $sname3 = "banned_user"; $sname4 = "date"; $sname5 = "user_user"; if($t == "ASC"){ $t = "DESC"; $t2 = "ASC"; } else{ $t = "ASC"; $t2 = "DESC"; } if($t == "ASC"){ $t3 = "";} else{ $t3 = "";} if($s == 1) $s = $sname1; if($s == 2) $s = $sname2; if($s == 3) $s = $sname3; if($s == 4) $s = $sname4; if($s == 5) $s = $sname5; //----------------------------------------------------------------- // Load the bans table //----------------------------------------------------------------- $bans = $db->getTable("SELECT * FROM bans ORDER BY $s $t2 $limit"); //----------------------------------------------------------------- // Make a foreach to separate the results //----------------------------------------------------------------- if($bans != FALSE) { foreach($bans as $idx=>$ban) { //----------------------------------------------------------------- // Count for ID + trick //----------------------------------------------------------------- if($s == $sname1 && $t == "ASC") $idx_count = str_replace("-", "", $idx + (($p - 1) * $rows_per_page + 1) - $numrows - 1); else $idx_count = $idx + (($p - 1) * $rows_per_page + 1); //----------------------------------------------------------------- // Check see if he is auto protection bot or regular ip //----------------------------------------------------------------- if($ban['user_user'] == "Auto Protection") $added_by = "{$ban['user_user']}"; else $added_by = "{$ban['user_user']}"; //----------------------------------------------------------------- // Make Layout //----------------------------------------------------------------- if(!$ban['banned_id'] && !$ban['banned_user']) $layout .= ""; else $layout .= ""; $layout .= " $idx_count {$ban['ip']} {$ban['banned_user']} ".today_yesterday($ban['date'])." $added_by"; if(!$ban['banned_id'] && !$ban['banned_user']) $layout .= "{$language["; else $layout .= "{$language["; $layout .= "\n"; //----------------------------------------------------------------- // Start from 1 //----------------------------------------------------------------- $idx ++; } } else { //----------------------------------------------------------------- // Reset to 0 //----------------------------------------------------------------- $idx = 0; //----------------------------------------------------------------- // Make Layout //----------------------------------------------------------------- $layout .= "{$language['Ban view desc8']}\n"; } //----------------------------------------------------------------- // Navigation Code //----------------------------------------------------------------- if ($p == 1) $nav_prev = " "; else { $prevpage = $p-1; $nav_prev = "« {$language['Ban previous']}"; } $nav_nr = '[ '.paginate($lastpage, $p, $PHP_SELF.'?n=modules/ban&s='.$s.'&t='.$t2).' ]'; if($idx == $numrows) $nav_nr = NULL; if ($p == $lastpage) $nav_next = " "; else { $nextcode = $numrows - $idx * $p; if($nextcode > $idx) $how_next = $idx; else $how_next = $nextcode; $nextpage = $p+1; $nav_next = "{$language['Ban next']} $how_next »"; } if($idx == $numrows) { $nav_head = "class='con1'"; $nav = NULL; } else { $nav_head = "class='head'"; $nav = ''.$nav_prev.''.$nav_next.''; } //----------------------------------------------------------------- // Echo the back link //----------------------------------------------------------------- echo "
{$language['Admin name']}
» {$language['Admin back']}

"; //----------------------------------------------------------------- // Start Layout + Navigation //----------------------------------------------------------------- ?>

 

>