query('SELECT * FROM admins'); $html = ""; $html = printHeader($html); if (isset($_REQUEST['key'])) { $Key = $_REQUEST['key']; while ($line = $DatabaseQuery->fetchArray()) { if ($line['key'] == $Key && $Key != "" && $line['key'] != "") { $id = $line['id']; $lastUsed = date($dateFormat); $Database->exec("UPDATE admins SET lastused='$lastUsed' WHERE id='$id'"); if ($storeIP || $storeIP == "true") { if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip = $_SERVER['REMOTE_ADDR']; } $Database->exec("UPDATE admins SET ip='$ip' WHERE id='$id'"); } if ($storeAgent || $storeAgent == "true") { $userAgent = $_SERVER['HTTP_USER_AGENT']; $Database->exec("UPDATE admins SET useragent='$userAgent' WHERE id='$id'"); } $Authorized = 1; break; } } // the stuff if ($Authorized) { $html .= "\t\t\t

Admin tools

\n"; $html .= "\t\t\t\n"; $html .= "\t\t\t
\n"; $html .= "\t\t\t\t\n"; $html .= "\t\t\t\t\n"; $html .= "\t\t\t\t\n"; $html .= "\t\t\t\t\n"; $html .= "\t\t\t\t\n"; $html .= "\t\t\t
\n"; } else { header('Location: admin.php?e=true'); die(); } } else { $Authorized = 0; $html .= "\t\t\t
\n"; $html .= "\t\t\t\t\n"; $html .= "\t\t\t\t\n"; $html .= "\t\t\t
\n"; if (isset($_REQUEST['e']) && $_REQUEST['e'] == "true") { $html .= "\t\t\t

Invalid administrator key.

\n"; } } $html = printFooter($html); print "$html"; ?>