Forum Moderators: coopster
Form login.php page user post username and passwd. in login_ckh.php page it validated usename and passwd from Mysql DB. but the problem is --> login_chk.php not redirect user automatically every time (some time it does,some time it does not). when it does not redirect, if i press F5/refresh then it redirects to desired page. Their is a BUG in the script. Hours passed but i cannt find any solution. (note: i m new in PHP and session concept). Waits for ur help... thanks.
___________________________________
Login_chk.php CODE
------------------------------------
<?
if(!$username ¦¦!$passwd)
{
header('Location: login.php');
}
require ("script/dbselect.inc");
$query= "select * from user where user_name='$username' and passwd='$passwd'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
if(!$row)
{
echo 'User does not exists';
exit();
}
else
{
session_start();
$group=$row['user_group'];
session_register("username","group");
if($_SESSION['group']=='a')
header('Location: superviser/index.php');
if($_SESSION['group']=='u')
header('Location: agent/index.php');
}
?>
------------------------------------------------------------