Please enter the required information - UserName and Password!
"; include 'TPGP_Login.htm'; exit(); } // Convert password to md5 hash $password = md5($password); // check if the user info validates the db $sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'"); $login_check = mysql_num_rows($sql); if($login_check > 0){ while($row = mysql_fetch_array($sql)){ foreach( $row AS $key => $val ){ $$key = stripslashes( $val ); } $_SESSION['usersid'] = $userid; $_SESSION['usersname'] = $username; $StudentID = $userid; mysql_query("UPDATE users SET last_login=now() WHERE userid='$StudentID'"); if ($username == "Administrator"){ $target = "http://www.tpgp.net/TPGP/TPGP_AdminMainMenu.php"; } else{ $target = "http://www.tpgp.net/TPGP/TPGP_ViewStudent.php"; } // header("Location: " . $target . $urlpage); header("Location: " . $target); } } else { echo "You could not be logged in! Either your Username or Password are invalid!
Please try again...
"; include 'TPGP_Login.htm'; } ?>