// Use session variable on this page. This function must put on the top of page. session_start(); ////// Logout Section. Delete all session variable. session_destroy(); $message=""; ////// Login Section. $Login=$_POST['Login']; if($Login){ // if clicked on Login button. $username=$_POST['username']; $password=$_POST['password']; // Encrypt password with md5() function. // Connect database. include("/home/httpd/vhosts/bromhall.com/httpdocs/includefiles/connection.php"); $sql = "select * from tbl30users where fld30LastName=(\"$username\") and fld30Password = ( \"$password\" ) "; $rs=mysql_query($sql, $conn) or die ("Could not execute query"); if(mysql_num_rows($rs)!='0'){ while($row1=mysql_fetch_array($rs)) {$userid=$row1[0]; $firstname=$row1[1]; $lastname=$row1[2];} // if match. $sql = "INSERT INTO tbl40logonhist (fld40LastName) values(\"$lastname\")"; $rs=mysql_query($sql, $conn) or die ("can't update logonhist"); session_register("username"); $_SESSION['userid'] = $userid; $_SESSION['firstname'] = $firstname; // Create session username. #session_register($username); // Create session username. header("location:Pages/ListProjects.php"); // Re-direct to main.php exit; }else{ // if not match. $message="--- Incorrect Username or Password ---"; } } // End Login authorize check. ?>
: