diff --git a/public/maxlogin.php b/public/maxlogin.php
index dd7f9ec0..265d50ef 100644
--- a/public/maxlogin.php
+++ b/public/maxlogin.php
@@ -4,12 +4,12 @@ dbconn();
loggedinorreturn();
if (get_user_class() < UC_SYSOP)
stderr("Error", "Permission denied.");
-
+
$action = isset($_POST['action']) ? htmlspecialchars($_POST['action']) : (isset($_GET['action']) ? htmlspecialchars($_GET['action']) : 'showlist');
$id = isset($_POST['id']) ? htmlspecialchars($_POST['id']) : (isset($_GET['id']) ? htmlspecialchars($_GET['id']) : '');
$update = isset($_POST['update']) ? htmlspecialchars($_POST['update']) : (isset($_GET['update']) ? htmlspecialchars($_GET['update']) : '');
-function check ($id) {
+function check ($id) {
if (!is_valid_id($id))
return stderr("Error","Invalid ID");
else
@@ -41,7 +41,7 @@ if ($order == 'id')
elseif ($order == 'ip')
$orderby = "ip";
elseif ($order == 'added')
- $orderby = "added";
+ $orderby = "added";
elseif ($order == 'attempts')
$orderby = "attempts";
elseif ($order == 'type')
@@ -50,7 +50,7 @@ elseif ($order == 'status')
$orderby = "banned";
else
$orderby = "attempts";
-
+
$perpage = 5;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $countrows, "maxlogin.php?order=$order&");
$msg = '';
@@ -64,17 +64,17 @@ $res = sql_query("SELECT * FROM loginattempts ORDER BY $orderby DESC $limit") o
if (mysql_num_rows($res) == 0)
print("
| Nothing found |
\n");
else
-{
+{
print("| ID | Ip Address | Action Time | ".
"Attempts | Attempt Type | Status |
\n");
while ($arr = mysql_fetch_assoc($res))
{
- $r2 = sql_query("SELECT id,username FROM users WHERE ip=".sqlesc($arr[ip])) or sqlerr(__FILE__,__LINE__);
- $a2 = mysql_fetch_assoc($r2);
- print("| $arr[id] | $arr[ip] " . ($a2[id] ? get_username($a2['id']) : "" ) . " | $arr[added] | $arr[attempts] | ".($arr[type] == "recover" ? "Recover Password Attempt!" : "Login Attempt!")." | ".($arr[banned] == "yes" ? "banned [unban]" : "not banned [ban]")." [delete] [edit] |
\n");
+ $r2 = sql_query("SELECT id,username FROM users WHERE ip=".sqlesc($arr['ip'])) or sqlerr(__FILE__,__LINE__);
+ $a2 = mysql_fetch_assoc($r2);
+ print("| {$arr['id']} | {$arr['ip']} " . ($a2['id'] ? get_username($a2['id']) : "" ) . " | {$arr['added']} | $arr[attempts] | ".($arr['type'] == "recover" ? "Recover Password Attempt!" : "Login Attempt!")." | ".($arr['banned'] == "yes" ? "banned [unban]" : "not banned [ban]")." [delete] [edit] |
\n");
}
-
+
}
print($msg);
print("\n");
@@ -84,45 +84,45 @@ searchform();
stdfoot();
}elseif ($action == 'ban') {
check($id);
- stdhead ("Max. Login Attemps - BAN");
+ stdhead ("Max. Login Attemps - BAN");
safe_query("UPDATE loginattempts SET banned = 'yes'",$id,"Ban");
header("Location: maxlogin.php?update=Ban");
}elseif ($action == 'unban') {
check($id);
stdhead ("Max. Login Attemps - UNBAN");
safe_query("UPDATE loginattempts SET banned = 'no'",$id,"Unban");
-
+
}elseif ($action == 'delete') {
check($id);
stdhead ("Max. Login Attemps - DELETE");
- safe_query("DELETE FROM loginattempts",$id,"Delete");
+ safe_query("DELETE FROM loginattempts",$id,"Delete");
}elseif ($action == 'edit') {
- check($id);
- stdhead ("Max. Login Attemps - EDIT (".htmlspecialchars($id).")");
+ check($id);
+ stdhead ("Max. Login Attemps - EDIT (".htmlspecialchars($id).")");
$query = sprintf("SELECT * FROM loginattempts WHERE id ='%s'",
mysql_real_escape_string($id));
$result = sql_query($query) or sqlerr(__FILE__,__LINE__);
$a = mysql_fetch_array($result);
print("\n");
- print("IP Address: ".htmlspecialchars($a[ip])." ");
- print("Action Time: ".htmlspecialchars($a[added])." |
");
+ print("IP Address: ".htmlspecialchars($a['ip'])." ");
+ print("Action Time: ".htmlspecialchars($a['added'])." |
");
print("
");
stdfoot();
-
+
}elseif ($action == 'save') {
- $id = sqlesc(intval($_POST['id'] ?? 0));
+ $id = intval($_POST['id'] ?? 0);
$ip = sqlesc($_POST['ip']);
- $attempts = sqlesc($_POST['attempts']);
+ $attempts = $_POST['attempts'];
$type = sqlesc($_POST['type']);
$banned = sqlesc($_POST['banned']);
check($id);
@@ -135,7 +135,7 @@ stdfoot();
else
header("Location: maxlogin.php?update=Edit");
}elseif ($action == 'searchip') {
- $ip = mysql_real_escape_string($_POST['ip']);
+ $ip = mysql_real_escape_string($_POST['ip']);
$search = sql_query("SELECT * FROM loginattempts WHERE ip LIKE '%$ip%'") or sqlerr(__FILE__,__LINE__);
stdhead ("Max. Login Attemps - Search");
print("Failed Login Attempts
");
@@ -143,15 +143,15 @@ stdfoot();
if (mysql_num_rows($search) == 0)
print("| Sorry, nothing found! |
\n");
else
- {
+ {
print("| ID | Ip Address | Action Time | ".
"Attempts | Attempt Type | Status |
\n");
while ($arr = mysql_fetch_assoc($search))
{
- $r2 = sql_query("SELECT id,username FROM users WHERE ip=".sqlesc($arr[ip])) or sqlerr(__FILE__,__LINE__);
- $a2 = mysql_fetch_assoc($r2);
- print("| $arr[id] | $arr[ip] " . ($a2[id] ? get_username($a2[id]) : "" ) . " | $arr[added] | $arr[attempts] | ".($arr[type] == "recover" ? "Recover Password Attempt!" : "Login Attempt!")." | ".($arr[banned] == "yes" ? "banned [unban]" : "not banned [ban]")." [delete] [edit] |
\n");
+ $r2 = sql_query("SELECT id,username FROM users WHERE ip=".sqlesc($arr['ip'])) or sqlerr(__FILE__,__LINE__);
+ $a2 = mysql_fetch_assoc($r2);
+ print("| {$arr['id']} | {$arr['ip']} " . ($a2['id'] ? get_username($a2['id']) : "" ) . " | {$arr['added']} | $arr[attempts] | ".($arr['type'] == "recover" ? "Recover Password Attempt!" : "Login Attempt!")." | ".($arr['banned'] == "yes" ? "banned [unban]" : "not banned [ban]")." [delete] [edit] |
\n");
}
}
print("\n");