function validateUser() { if (isValidUser()) { logVerify(getCookie('ID'), "OK"); changeCookie(); } else { logVerify(getCookie('ID'), "INVALID"); header("Location: logout.php"); } }
require_once 'include/functions.php'; // Connects to your Database connectDatabase(); slashAllInputs(); //checks cookies to make sure they are logged in if (getCookie('ID')) { $hashUsername = getCookie('ID'); $sessionId = getCookie('Session_ID'); $check = mysql_query("SELECT * FROM users WHERE sha256_user = '******'") or die(mysql_error()); while ($info = mysql_fetch_array($check)) { $username = $info['username']; //if the cookie has the wrong sessionId, they are taken to the login page if ($sessionId != $info['session_id']) { header("Location: logout.php"); } elseif ($info['admin']) { changeCookie(); // keep the session id changing if (isset($_POST['emailUsers'])) { $emailList = ""; $userCheck = mysql_query("SELECT * FROM users") or die(mysql_error()); while ($userInfo = mysql_fetch_array($userCheck)) { $emailList .= $userInfo['email']; } } echo file_get_contents("admin_header.html"); echo "<br />\n"; echo "<table class=\"default\">\n"; echo "<tr><td>Username</td>\n"; echo "<td>Car Number</td><td>Year</td><td>Make</td><td>Model</td><td>color</td><td>Treadwear</td>\n"; echo "<td>SCCA Class</td><td>SCCNH Class</td><td>NEHA Class</td><td>Hillclimb Class</td></tr>\n"; // $userCheck = mysql_query("SELECT * FROM users WHERE username != '$username'")or die(mysql_error());