Zeile 3 | Zeile 3 |
---|
* MyBB 1.2 * Copyright � 2006 MyBB Group, All Rights Reserved *
|
* MyBB 1.2 * Copyright � 2006 MyBB Group, All Rights Reserved *
|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html
| * Website: http://www.mybboard.net * License: http://www.mybboard.net/eula.html
|
*
|
*
|
* $Id: class_session.php 2224 2006-09-14 00:35:33Z chris $
| * $Id: class_session.php 3278 2007-08-23 02:23:28Z Tikitiki $
|
*/
class session
| */
class session
|
Zeile 63 | Zeile 63 |
---|
}
// Attempt to load the session from the database.
|
}
// Attempt to load the session from the database.
|
$query = $db->simple_select(TABLE_PREFIX."sessions", "*", "sid='".$this->sid."' AND ip='".$db->escape_string($this->ipaddress)."'", 1);
| $query = $db->simple_select(TABLE_PREFIX."sessions", "*", "sid='".$this->sid."' AND ip='".$db->escape_string($this->ipaddress)."'", array('limit' => 1));
|
$session = $db->fetch_array($query); if($session['sid']) {
| $session = $db->fetch_array($query); if($session['sid']) {
|
Zeile 105 | Zeile 105 |
---|
}
// As a token of our appreciation for getting this far, give the user a cookie
|
}
// As a token of our appreciation for getting this far, give the user a cookie
|
my_setcookie("sid", $this->sid, -1, true);
| if((!$_COOKIE['sid'] || $_COOKIE['sid'] != $this->sid) && $this->sid) { my_setcookie("sid", $this->sid, -1, true); }
|
}
/**
| }
/**
|
Zeile 120 | Zeile 123 |
---|
$uid = intval($uid); $query = $db->query("
|
$uid = intval($uid); $query = $db->query("
|
SELECT u.*, f.*, b.dateline AS bandate, b.lifted AS banlifted, b.oldgroup AS banoldgroup
| SELECT u.*, f.*, b.dateline AS bandate, b.lifted AS banlifted, b.oldgroup AS banoldgroup, b.olddisplaygroup as banolddisplaygroup, b.oldadditionalgroups as banoldadditionalgroups
|
FROM ".TABLE_PREFIX."users u LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid) LEFT JOIN ".TABLE_PREFIX."banned b ON (b.uid=u.uid) WHERE u.uid='$uid'
|
FROM ".TABLE_PREFIX."users u LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid) LEFT JOIN ".TABLE_PREFIX."banned b ON (b.uid=u.uid) WHERE u.uid='$uid'
|
| LIMIT 1
|
"); $mybb->user = $db->fetch_array($query);
|
"); $mybb->user = $db->fetch_array($query);
|
|
|
// Check the password if we're not using a session if($password != $mybb->user['loginkey'] || !$mybb->user['uid'])
|
// Check the password if we're not using a session if($password != $mybb->user['loginkey'] || !$mybb->user['uid'])
|
{
| {
|
unset($mybb->user); $this->uid = 0; return false; } $this->uid = $mybb->user['uid'];
|
unset($mybb->user); $this->uid = 0; return false; } $this->uid = $mybb->user['uid'];
|
| // Set the logout key for this user $mybb->user['logoutkey'] = md5($mybb->user['loginkey']);
|
// Sort out the private message count for this user. if(($mybb->user['totalpms'] == -1 || $mybb->user['unreadpms'] == -1 || $mybb->user['newpms'] == -1) && $mybb->settings['enablepms'] != "no") // Forced recount
| // Sort out the private message count for this user. if(($mybb->user['totalpms'] == -1 || $mybb->user['unreadpms'] == -1 || $mybb->user['newpms'] == -1) && $mybb->settings['enablepms'] != "no") // Forced recount
|
Zeile 148 | Zeile 155 |
---|
if($mybb->user['newpms'] == -1) { $update += 2;
|
if($mybb->user['newpms'] == -1) { $update += 2;
|
}
| }
|
if($mybb->user['unreadpms'] == -1) { $update += 4;
| if($mybb->user['unreadpms'] == -1) { $update += 4;
|
Zeile 181 | Zeile 188 |
---|
$time = time(); if($time - $mybb->user['lastactive'] > 900) {
|
$time = time(); if($time - $mybb->user['lastactive'] > 900) {
|
$db->shutdown_query("UPDATE ".TABLE_PREFIX."users SET lastvisit='".$mybb->user['lastactive']."', lastactive='$time' $popupadd WHERE uid='".$mybb->user['uid']."'");
| $db->shutdown_query("UPDATE ".TABLE_PREFIX."users SET lastvisit='".$mybb->user['lastactive']."', lastactive='$time' $popupadd WHERE uid='".$mybb->user['uid']."' LIMIT 1");
|
$mybb->user['lastvisit'] = $mybb->user['lastactive']; require_once MYBB_ROOT."inc/functions_user.php"; update_pm_count('', 2); } else {
|
$mybb->user['lastvisit'] = $mybb->user['lastactive']; require_once MYBB_ROOT."inc/functions_user.php"; update_pm_count('', 2); } else {
|
$mybb->user['lastvisit'] = $mybb->user['lastvisit'];
| |
$timespent = time() - $mybb->user['lastactive'];
|
$timespent = time() - $mybb->user['lastactive'];
|
$db->shutdown_query("UPDATE ".TABLE_PREFIX."users SET lastactive='$time', timeonline=timeonline+$timespent $popupadd WHERE uid='".$mybb->user['uid']."'");
| $db->shutdown_query("UPDATE ".TABLE_PREFIX."users SET lastactive='$time', timeonline=timeonline+$timespent $popupadd WHERE uid='".$mybb->user['uid']."' LIMIT 1");
|
}
// Sort out the language and forum preferences.
| }
// Sort out the language and forum preferences.
|
Zeile 214 | Zeile 220 |
---|
break; case "4": $mybb->settings['dateformat'] = "m.d.y";
|
break; case "4": $mybb->settings['dateformat'] = "m.d.y";
|
break;
| break;
|
case "5": $mybb->settings['dateformat'] = "d-m-Y";
|
case "5": $mybb->settings['dateformat'] = "d-m-Y";
|
break;
| break;
|
case "6": $mybb->settings['dateformat'] = "d-m-y";
|
case "6": $mybb->settings['dateformat'] = "d-m-y";
|
break;
| break;
|
case "7": $mybb->settings['dateformat'] = "d.m.Y"; break;
| case "7": $mybb->settings['dateformat'] = "d.m.Y"; break;
|
Zeile 235 | Zeile 241 |
---|
break; case "11": $mybb->settings['dateformat'] = "jS F Y";
|
break; case "11": $mybb->settings['dateformat'] = "jS F Y";
|
break;
| break;
|
case "12": $mybb->settings['dateformat'] = "l, jS F Y";
|
case "12": $mybb->settings['dateformat'] = "l, jS F Y";
|
break;
| break;
|
default: break; }
| default: break; }
|
Zeile 247 | Zeile 253 |
---|
// Choose time format. if($mybb->user['timeformat'] != "0" || $mybb->user['timeformat'] != '') {
|
// Choose time format. if($mybb->user['timeformat'] != "0" || $mybb->user['timeformat'] != '') {
|
switch($mybb->user['timeformat']) {
| switch($mybb->user['timeformat']) {
|
case "1": $mybb->settings['timeformat'] = "h:i a";
|
case "1": $mybb->settings['timeformat'] = "h:i a";
|
break;
| break;
|
case "2": $mybb->settings['timeformat'] = "h:i A"; break; case "3": $mybb->settings['timeformat'] = "H:i"; break;
|
case "2": $mybb->settings['timeformat'] = "h:i A"; break; case "3": $mybb->settings['timeformat'] = "H:i"; break;
|
}
| }
|
}
// Find out the threads per page preference. if($mybb->user['tpp'])
|
}
// Find out the threads per page preference. if($mybb->user['tpp'])
|
{
| {
|
$mybb->settings['threadsperpage'] = $mybb->user['tpp'];
|
$mybb->settings['threadsperpage'] = $mybb->user['tpp'];
|
}
| }
|
// Find out the posts per page preference. if($mybb->user['ppp']) { $mybb->settings['postsperpage'] = $mybb->user['ppp'];
|
// Find out the posts per page preference. if($mybb->user['ppp']) { $mybb->settings['postsperpage'] = $mybb->user['ppp'];
|
}
| }
|
// Check if this user is currently banned and if we have to lift it.
|
// Check if this user is currently banned and if we have to lift it.
|
if($mybb->user['bandate'] && $mybb->user['banlifted'] && $mybb->user['banlifted'] < $time) // hmmm...bad user... how did you get banned =/
| if(!empty($mybb->user['bandate']) && (isset($mybb->user['banlifted']) && !empty($mybb->user['banlifted'])) && $mybb->user['banlifted'] < $time) // hmmm...bad user... how did you get banned =/
|
{ // must have been good.. bans up :D
|
{ // must have been good.. bans up :D
|
$db->shutdown_query("UPDATE ".TABLE_PREFIX."users SET usergroup='".$mybb->user['banoldgroup']."' WHERE uid='".$mybb->user['uid']."'");
| $db->shutdown_query("UPDATE ".TABLE_PREFIX."users SET usergroup='".$mybb->user['banoldgroup']."' WHERE uid='".$mybb->user['uid']."' LIMIT 1");
|
$db->shutdown_query("DELETE FROM ".TABLE_PREFIX."banned WHERE uid='".$mybb->user['uid']."'"); // we better do this..otherwise they have dodgy permissions
|
$db->shutdown_query("DELETE FROM ".TABLE_PREFIX."banned WHERE uid='".$mybb->user['uid']."'"); // we better do this..otherwise they have dodgy permissions
|
$query = $db->simple_select(TABLE_PREFIX."usergroups", "*", "gid='".$mybb->user['banoldgroup']."'", array('limit' => 1)); $group = $db->fetch_array($query); $mybb->user['usergroup'] = $group['usergroup'];
| $mybb->user['usergroup'] = $mybb->user['banoldgroup']; $mybb->user['displaygroup'] = $mybb->user['banolddisplaygroup']; $mybb->user['additionalgroups'] = $mybb->user['banoldadditionalgroups'];
$mybbgroups = $mybb->user['usergroup']; if($mybb->user['additionalgroups']) { $mybbgroups .= ','.$mybb->user['additionalgroups']; }
|
}
|
}
|
| else if(!empty($mybb->user['bandate']) && (empty($mybb->user['banlifted']) || !empty($mybb->user['banlifted']) && $mybb->user['banlifted'] > $time)) { $mybbgroups = $mybb->user['usergroup']; } else { // Gather a full permission set for this user and the groups they are in. $mybbgroups = $mybb->user['usergroup']; if($mybb->user['additionalgroups']) { $mybbgroups .= ','.$mybb->user['additionalgroups']; } }
|
|
|
// Gather a full permission set for this user and the groups they are in. $mybbgroups = $mybb->user['usergroup'].",".$mybb->user['additionalgroups'];
| |
$mybb->usergroup = usergroup_permissions($mybbgroups); if(!$mybb->user['displaygroup']) {
| $mybb->usergroup = usergroup_permissions($mybbgroups); if(!$mybb->user['displaygroup']) {
|
Zeile 445 | Zeile 469 |
---|
$onlinedata['nopermission'] = 0; $sid = $db->escape_string($sid);
|
$onlinedata['nopermission'] = 0; $sid = $db->escape_string($sid);
|
$db->update_query(TABLE_PREFIX."sessions", $onlinedata, "sid='".$sid."'");
| $db->update_query(TABLE_PREFIX."sessions", $onlinedata, "sid='".$sid."'", 1);
|
}
/**
| }
/**
|
Zeile 461 | Zeile 485 |
---|
// If there is a proper uid, delete by uid. if($uid > 0) {
|
// If there is a proper uid, delete by uid. if($uid > 0) {
|
$db->delete_query(TABLE_PREFIX."sessions", "uid=".$uid);
| $db->delete_query(TABLE_PREFIX."sessions", "uid='{$uid}'", 1);
|
$onlinedata['uid'] = $uid; } // Else delete by ip. else {
|
$onlinedata['uid'] = $uid; } // Else delete by ip. else {
|
$db->delete_query(TABLE_PREFIX."sessions", "ip='".$this->ipaddress."'");
| $db->delete_query(TABLE_PREFIX."sessions", "ip='".$db->escape_string($this->ipaddress)."'", 1);
|
$onlinedata['uid'] = 0; }
| $onlinedata['uid'] = 0; }
|
Zeile 515 | Zeile 539 |
---|
return $array; } }
|
return $array; } }
|
| ?>
|