Hi,
i have made simple login script. It is working fine on my local machine winXp. but it is not working properly at webserver i.e. also WinNT.
I hv created verify.php
<? session_start();
include('connection.php');
global $link;
$uid=trim($POST['username']);
$pass=trim($POST['password']);
$sql="select uid,pass from login_info where uid='". $uid. "' and pass='". $pass ."'";
$result=mysql_query($sql,$link);
$num_rows=mysql_num_rows($result);
if ($num_rows=="0"){
header("Location: http://www.mydomain.com/cp/index.php?err=2");
}
else
{
$SESSION['loggedin']=true;
$SESSION['login']="ok";
header("Location: http://www.mydomain.com/cp/protectedpage.php");
}
?>
And check.php to check whether user has been logged in or not.
check.php
<? session_start();
if ($_SESSION['loggedin']==false){
header("Location: http://www.mydomain.com/cp/index.php");
}
?>
I have included with <? include('check.php') ?> to all my protected page.
But when i logged in with my correct username and password , it does not redirect to protected page. If i remove check.php , then it redirect to protected page.
Why it is not redirecting to protected page with correct username and password.
Please advice.
Thanks in advance.