PHP Code:
function maxcoder ()
{
global $CURUSER;
$lmaxclass = 7;
$filename = ROOT_PATH . "settings/STAFFNAMES";
$filename2 = ROOT_PATH . "settings/STAFFIDS";
if ($CURUSER['class'] >= $lmaxclass) {
$fp = fopen($filename, 'r');
while (!feof($fp)) {
$staffnames = fgets($fp);
$results = explode(' ', $staffnames);
}
$added = sqlesc(get_date_time());
if (!in_array($CURUSER['username'], $results, true)) { // /////== true for strict comparison - super class detection .. not in array = warning issued ?
sql_query("UPDATE users set warned='yes' WHERE id=$CURUSER[id]");
$subject = sqlesc("Alert Super User Has been Detected");
$body = sqlesc("User " . $CURUSER["username"] . " has attempted to hack the tracker using a super class - the account has been disabled");
auto_post($subject , $body);
$msg = "Hack Attempt Detected - Member has been warned : Username: " . $CURUSER["username"] . " - UserID: " . $CURUSER["id"] . " - UserIP : " . getip();
sql_query("INSERT INTO messages (poster, sender, receiver, added, subject, msg) VALUES(0, 0, '1', '" . get_date_time() . "', " . $subject . " , " . sqlesc($msg) . ")") or sqlerr(__FILE__, __LINE__);
write_log($msg);
fclose($fp);
stderr("Access Denied!", "Ha Ha - Did you honestly think you could pull that one off !");
}
fclose($fp);
}
define ('UC_STAFF', 4); ///////== Minumum Staff Level (4=UC_MODERATOR)
if ($CURUSER['class'] >= UC_STAFF) {
$fp2 = fopen($filename2, 'r');
while (!feof($fp2)) {
$staffids = fgets($fp2);
$results2 = explode(' ', $staffids);
}
if (!in_array($CURUSER['id'], $results2, true)) { // ////== true for strict comparison if there not in the array disable the fuckers and ban the ip :)
sql_query("UPDATE users set warned='yes' WHERE id=$CURUSER[id]");
$subject = sqlesc("Staff Account Hack Detected");
$body = sqlesc("User " . $CURUSER["username"] . " has attempted to hack the tracker using an unauthorized account- the account has been disabled");
auto_post($subject , $body);
$msg = "Fake Account Detected - User warned : Username: " . $CURUSER["username"] . " - UserID: " . $CURUSER["id"] . " - UserIP : " . getip();
sql_query("INSERT INTO messages (poster, sender, receiver, added, subject, msg) VALUES(0, 0, '1', '" . get_date_time() . "', " . $subject . " , " . sqlesc($msg) . ")") or sqlerr(__FILE__, __LINE__);
write_log($msg);
fclose($fp2);
stderr("Access Denied!", "Sorry but your not an authorized staff member - nice try your banned !");
}
fclose($fp2);
}
return true;
}
Thats it altered now - querys i changed disabled = yes to warned = yes - I have removed the ip ban function from it, easy added back though its only a few lines you can see from comparing both blocks - Remember if any staff have fallen foul of it you need to delete those entrys from the bans table - See when it saves - if you refresh your page after the save using the refresh link does it show the new additions ?