Sir I am using IIS Manager, as follows
and I have these codes for login.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once("../includes/connectsql.php");
require_once("../includes/functions.php");
$error = false;
$cerror="";
$cur_id=0;
$cur_user="";
$cur_email="";
$mypass="";
if(isset($_POST['login'])){
$muser=clean($_POST['username']);
$mpass=clean($_POST['password']);
$mypass=SHA1($mpass);
if (!preg_match("/^[a-zA-Z0-9]+$/",$mpass)) {
$error = true;
$cerror="Password must contain only alphabets and space";
}
if(!filter_var($muser,FILTER_VALIDATE_EMAIL)) {
$error = true;
$cerror = "Please Enter Valid Email ID";
}
if ($error == false)
{
$query="select * from u_login where email ='".$muser."' and pass='".$mypass."'";
$result=sqlsrv_query($con,$query)or die ("Error". sqlsrv_errors($con)) ;
while($res = sqlsrv_fetch_array($result)) {
$cur_id=($res['usno']);
$cur_user=($res['userid']);
$cur_email=($res['email']);
}
//echo $cur_use;
if(empty($cur_user)){
$cerror="Email or Password is invalid";
}
else
{
date_default_timezone_set('Asia/Karachi');
session_start();
//session_regenerate_id();
$_SESSION['id'] = $cur_id;
// $_SESSION['logout'] = $row2['logout'];
$_SESSION['user'] = $cur_user;
$_SESSION['email'] = $cur_email;
$_SESSION["startTime"] = date('Y-m-d H:i:s');
var_dump($_SESSION);
// header("location:../index.php");
// session_write_close();
// exit();
}
}
}
?>
When I enter correct user name and password then following redirect line does not work
header("location:../index.php");
I checked with
var_dump($_SESSION);
it says:
![Untitled.png](/attachments/large/4/8835633042d9659ef4f6f3c9733414a5.png "align-center")
What is this problem?
I think it is session problem.
Please help