If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
setcookie("sid", $value, time()+3600);//expires in 1 hour
?
Cos in my login.php, i have this
$tm = time();
$xtm = $tm + (getsxtm()*60);
$did = $uid.$tm;
$res = mysql_query("INSERT INTO ibwf_ses SET id='".md5($did)."', uid='".getuid_nick($uid)."', expiretm='".$xtm."'");
if($res)
{
$tolog=true;
echo "<img src=\"../images/ok.gif\" alt=\"+\"/>You have logged in successfully as $uid<br/>";
echo "Please Bookmark this page to avoid repeating the login proccess in the future<br/><br/>";
$idn = getuid_nick($uid);
$lact = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$idn."'"));
mysql_query("UPDATE ibwf_users SET lastvst='".$lact[0]."' WHERE id='".$idn."'");
}else{
//is user already logged in?
$logedin = mysql_fetch_array(mysql_query("SELECT (*) FROM ibwf_ses WHERE uid='".$getuid_nick($uid)."'"));
if($logedin[0]>0)
{
//yip, so let's just update the expiration time
$xtm = time() + (getsxtm()*60);
$res = mysql_query("UPDATE ibwf_ses SET expiretm='".$xtm."' WHERE uid='".getuid_nick($uid)."'");
if($res)
{
$tolog=true;
echo "<img src=\"../images/ok.gif\" alt=\"+\"/>You have logged in successfully as $uid<br/>";
echo "Please Bookmark this page to avoid repeating the login proccess in the future<br/><br/>";
}else{
echo "<img src=\"../images/point.gif\" alt=\"!\"/>Can't login at the time, pls try later<br/>"; //no chance this could happen unless there's error in mysql connection
}
}
}
}
}
Please help. And please don't flame me, i know am a noob.
Comment