"; echo ""; echo ""; echo ""; echo "
Name
Pass
"; echo ""; echo""; session_start(); $user=$_POST[user]; $pass=$_POST[pass]; $user = stripslashes($user); $pass = stripslashes($pass); $user = mysql_real_escape_string($user); $pass = mysql_real_escape_string($pass); if($user!="" and $pass!="") { echo $user; echo $pass; $searchright=mysqli_query($link,"SELECT * FROM teacher WHERE shortdesc='$user' and passid='$pass' "); // Mysql_num_row is counting table row @$count=mysqli_num_rows($searchright); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION['user'] = "$user"; $_SESSION['pass'] = "$pass"; header("location:index.php"); } else { echo "Wrong Username or Password"; } } ?>