3 include_once("conn.php");
5 /* verify username and password - do not pass if incorrect */
6 if(!isset($_COOKIE["username"])) { include("login.php"); exit; }
7 if(!isset($_COOKIE["password"])) { include("login.php"); exit; }
9 $_COOKIE["username"] = mysql_real_escape_string($_COOKIE["username"]);
10 $_COOKIE["password"] = mysql_real_escape_string($_COOKIE["password"]);
12 $sql = "select count(*), user_id, role, name from users where email='". $_COOKIE["username"]. "' and password=SHA('".$_COOKIE["password"]."')";
14 $result = mysql_query($sql);
16 if (!$result) { die("SQL ERROR"); }
18 $row = mysql_fetch_row($result);
20 if($row[0] > 0) { } else { echo "Incorrect Username or Password."; }
22 /* if we don't get a good login, send username and password form and exit */
23 if($row[0] < 1) { include("login.php"); exit; }
25 /* set global var with user id and email address - shown on pages and used in URL's */
30 if($user_id == NULL) { die("User ID Not Set For This User. Contact Technical Support."); }