session out of date if same session exists. this doesnt work any ideas?
PHP Code:
function logged($sid)
{
if(trim($sid)=="")return false;
$loginfo = mysql_fetch_array(mysql_query("SELECT uname, upwd, ipadd, browser FROM rwc_sessions WHERE sid='".$sid."' LIMIT 1"));
if($loginfo['uname']==0||$loginfo['uname']==""||!isuser($loginfo['uname']))
{
return false;
}
//password is out of date
$uinfo = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM rwc_users WHERE id='".$loginfo['uname']."' AND pass='".$loginfo['upwd']."'"));
if($uinfo[0]==0)
{
return false;
}
global $ubr; global $uip;
if($uip!=$loginfo['ipadd']||$ubr!=$loginfo['browser'])
{
autopm(1, $loginfo['uname'], 'IP: '.$uip.'[br/]Browser: '.$ubr.'[br/]has guessed your session ID, though they cant login its necessary to forward this PM to an Admin');
return false;
}
return true;
}
function isuser($uid)
{
$isit = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM rwc_users WHERE id='".$uid."'"));
if($isit[0]>0)
{
return true;
}
return false;
}
function sid2uid($sid)
{
$theuid = mysql_fetch_array(mysql_query("SELECT uname FROM rwc_sessions WHERE sid='".$sid."' LIMIT 1"));
return $theuid[0];
}