sessions
Citar
$sessionid = isset($_COOKIE[COOKIE_PREFIX . 'sessionid']) ? $_COOKIE[COOKIE_PREFIX . 'sessionid'] : 0;
if($sessionid)
{
$session_arr = $DB->query_first("SELECT * FROM {sessions} WHERE sessionid = '$sessionid'
AND lastactivity > " . (TIMENOW - COOKIE_TIMEOUT) . "
AND ipaddress = '" . USERIP . "'
AND useragent = '" . USERAGENT . "'");
if($session_arr)
{
if($user_arr = $DB->query_first("SELECT * FROM {users} WHERE userid = " . $session_arr['userid'] . " LIMIT 1"))
{
$userinfo = GetUserInfo($user_arr);
}
// update session
$DB->query("UPDATE {sessions} SET lastactivity = " . TIMENOW . " WHERE sessionid = '$sessionid'");
}
}
if($sessionid)
{
$session_arr = $DB->query_first("SELECT * FROM {sessions} WHERE sessionid = '$sessionid'
AND lastactivity > " . (TIMENOW - COOKIE_TIMEOUT) . "
AND ipaddress = '" . USERIP . "'
AND useragent = '" . USERAGENT . "'");
if($session_arr)
{
if($user_arr = $DB->query_first("SELECT * FROM {users} WHERE userid = " . $session_arr['userid'] . " LIMIT 1"))
{
$userinfo = GetUserInfo($user_arr);
}
// update session
$DB->query("UPDATE {sessions} SET lastactivity = " . TIMENOW . " WHERE sessionid = '$sessionid'");
}
}
metodo query first:
Citar
function query_first($query_string)
{
$args = func_get_args();
array_shift($args);
printf("SQL -> %s",$query_string); //esto es mio para observar la consulta.
$queryid = $this->query($query_string, $args);
$returnarray = $this->fetch_array($queryid, $query_string);
$this->free_result($queryid);
return $returnarray;
}
{
$args = func_get_args();
array_shift($args);
printf("SQL -> %s",$query_string); //esto es mio para observar la consulta.
$queryid = $this->query($query_string, $args);
$returnarray = $this->fetch_array($queryid, $query_string);
$this->free_result($queryid);
return $returnarray;
}
el metodo query es mas de lo mismo, no hace nada especial sobre la cadena.