Here is my login code for ur reference :
PHP 1:
<?
include('logdet.php3');
$link = mysql_connect($DB_HOST, $DB_USER, $DB_PSWD);
$login = strtolower($LoginName);
$password = strtolower($NewPassword);
$flag = "n";
$result=mysql($DB_NAME,"SELECT * FROM u_table where user_id='".$login."' and user_password='".$password."'");
while ($myrow = mysql_fetch_row($result))
{
$flag="y";
$path= $myrow[2]
$cid= $path;
@setcookie("user_id",$login,time()+7200,"/","www.xxyyzz.com",0);
}
if ($flag != "y")
{
echo "<body>";
echo "<p align=center><h2> Sorry ! Access Denied </h2></p>" ;
echo "<p align=center><h4> Check your login name and password </h4></p>";
echo "<BR><BR>";
echo "<a href='javascript:history.back()'>Click Here to go Back</a>";
echo "</body>";
return;
}
else
{
echo "<body><script language='javascript'>";
echo "location.href='sec.php3?path=".$path." ' ";
echo "</script></body>";
}
?>
PHP 2 :
<?
if(!isset($HTTP_COOKIE_VARS["user_id"])) {
echo "<head><script language='javascript'>";
echo "location.href='cookieexpire.htm'";
echo "</script></head>";
exit();
}
?>
logdet.php3 variables such as $DB_HOST etc containing name and passwords of database. It does not contain any html code in it.
LoginName is the variable the which i get from my html form which i validate with my users table and if found try to set a cookie.
But on some windows 98 systems this cookie is not set which i verify in my second php3 and then send him to cookieexpire.htm.