Hello I have three PHP codes where one page I have is of index.php
where I am scanning the username and password from the user and then sending it to another file userlogin_process.php
where I am first starting the session and then I am matching the scanned values with the database and if they match I am storing them into session variable but it shows me 2 warnings on that page Cannot send session cache limiter - headers already sent and last page I have is of user_session.php
where I am locating the user to the home page of the website.
index.php
session_start();
user_loginprocess.php
session_start();
include("db.php");
$uname = $_POST['username'];
$upass = $_POST['userpass'];
echo $uname;
echo $upass;
$sql = mysql_query("select id,fname,mobile from user where fname='$uname'") or die(mysql_error());
$count = mysql_num_rows($sql);
if ($count > 0){
while($row = mysql_fetch_array($sql)){
$id = $row['id'];
$fname = $row['fname'];
$mobile = $row['mobile'];
}
}
if( $uname == $fname && $upass == $mobile ){
$_SESSION['uid'] = $id;
$_SESSION['username'] = $fname;
$_SESSION['usermobile'] = $mobile;
$_SESSION['login'] = "yes";
header('location:user_session.php');
}
else{
header('location:index.php?msg=incorrect');
}
?>
user_sesssion.php
session_start();
if( isset($_SESSION['login']) == "yes"){
header('location:user_detail.php?pageno=1');
}
else{
header('location:index.php?msg=login');
}
?>
No comments:
Post a Comment