Hi,
Please help me to resolve my Script Redirection problem.
Actually i have developing simple crm application php using pdo->prepare. this is working fine in localhost.
but what is my problem means redirection is not working, when i uploaded to server.
for refernce i hereby attached . please help me anyone.
<?php
session_start();
$errmsg_arr = array();
$errflag = false;
// configuration
include("config/db-config.php");
// new data
$user = $_POST['uname'];
$password = $_POST['pword'];
if($user == '') {
$errmsg_arr[] = 'You must enter your Username';
$errflag = true;
}
if($password == '') {
$errmsg_arr[] = 'You must enter your Password';
$errflag = true;
}
// query
$result = $db->prepare("SELECT * FROM admin WHERE username= ? AND password= ?");
$result->bindParam(1, $user);
$result->bindParam(2, $password);
$result->execute();
// $rows = $result->fetch(PDO::FETCH_NUM);
if($row = $result->fetch(PDO::FETCH_ASSOC)) //ftch value as row or array
{
$_SESSION["SESS_USERID"] = $row['id'];
$_SESSION["SESS_FIRSTNAME"] = $row['name'];
$_SESSION["SESSION_USER_NAME"] = $row['username'];
header('Location: admin-home.php');
}
else{
$errmsg_arr[] = 'Username and Password are not found';
$errflag = true;
}
if($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;
session_write_close();
header("location: index.php?=Username and Password are not found");
exit();
}
?>