I am trouble with session; I know it theoretically but I encountered with it how to use session , transferring username to other page and adding logout in order to clear the current logged account information.
Since I have no idea of session usage I commented it.
This is the checklogin.php
<?php
session_start();
include("database.php");
// username and password sent from form
$name=$_POST['email'];
$password=$_POST['pwd'];
//select data from database
$sql="SELECT * FROM $tbl_name WHERE usermail='$name' && userpasswd='$password'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if( $count == 1) {
// Register $myusername, $mypassword and redirect to file "search.php"
//session_register("$name");
//session_register("$password");
//$_SESSION['name']= $name;
header("location:jcte/index.php");
} else {
$msg = "Wrong Username or Password. Please retry";
header("location:ErrorPage.html");
}
?>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…