Vergleich inc/class_session.php - 1.6.4 - 1.6.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: class_session.php 5297 2010-12-28 22:01:14Z Tomm $

 * $Id$

 */

class session

 */

class session

Zeile 16Zeile 16
	public $ipaddress = '';
public $useragent = '';
public $is_spider = false;

	public $ipaddress = '';
public $useragent = '';
public $is_spider = false;

	public $logins = 1;
public $failedlogin = 0;

 

/**
* Initialize a session


/**
* Initialize a session

Zeile 39Zeile 37
		// Attempt to find a session id in the cookies.
if(isset($mybb->cookies['sid']))
{

		// Attempt to find a session id in the cookies.
if(isset($mybb->cookies['sid']))
{

			$this->sid = $db->escape_string($mybb->cookies['sid']);

			$sid = $db->escape_string($mybb->cookies['sid']);

			// Load the session

			// Load the session

			$query = $db->simple_select("sessions", "*", "sid='{$this->sid}' AND ip='".$db->escape_string($this->ipaddress)."'", array('limit' => 1));

			$query = $db->simple_select("sessions", "*", "sid='{$sid}' AND ip='".$db->escape_string($this->ipaddress)."'", array('limit' => 1));

			$session = $db->fetch_array($query);
if($session['sid'])
{
$this->sid = $session['sid'];

			$session = $db->fetch_array($query);
if($session['sid'])
{
$this->sid = $session['sid'];

				$this->uid = $session['uid'];

 
			}

			}

			else
{
$this->sid = 0;
$this->uid = 0;
$this->logins = 1;
$this->failedlogin = 0;
}
}

// Still no session, fall back
if(!$this->sid)
{
$this->sid = 0;
$this->uid = 0;
$this->logins = 1;
$this->failedlogin = 0;

 
		}

// If we have a valid session id and user id, load that users session.

		}

// If we have a valid session id and user id, load that users session.

		if($mybb->cookies['mybbuser'])

		if(!empty($mybb->cookies['mybbuser']))

		{
$logon = explode("_", $mybb->cookies['mybbuser'], 2);
$this->load_user($logon[0], $logon[1]);

		{
$logon = explode("_", $mybb->cookies['mybbuser'], 2);
$this->load_user($logon[0], $logon[1]);

Zeile 94Zeile 75

// Still nothing? JUST A GUEST!
if(!$this->is_spider)


// Still nothing? JUST A GUEST!
if(!$this->is_spider)

			{

			{

				$this->load_guest();
}
}


// As a token of our appreciation for getting this far (and they aren't a spider), give the user a cookie

				$this->load_guest();
}
}


// As a token of our appreciation for getting this far (and they aren't a spider), give the user a cookie

		if($this->sid && ($mybb->cookies['sid'] != $this->sid) && $this->is_spider != true)

		if($this->sid && (isset($mybb->cookies['sid'] ) && $mybb->cookies['sid'] != $this->sid) && $this->is_spider != true)

		{
my_setcookie("sid", $this->sid, -1, true);
}

		{
my_setcookie("sid", $this->sid, -1, true);
}

Zeile 125Zeile 106
		{
$cache->update_banned();
$bannedcache = $cache->read("banned");

		{
$cache->update_banned();
$bannedcache = $cache->read("banned");

		}

		}

		
$uid = intval($uid);
$query = $db->query("

		
$uid = intval($uid);
$query = $db->query("

Zeile 137Zeile 118
		");
$mybb->user = $db->fetch_array($query);


		");
$mybb->user = $db->fetch_array($query);


		$this->logins = $mybb->user['loginattempts'];
$this->failedlogin = $mybb->user['failedlogin'];

if($bannedcache[$uid])

		if(!empty($bannedcache[$uid]))




		{
$banned_user = $bannedcache[$uid];
$mybb->user['bandate'] = $banned_user['dateline'];

		{
$banned_user = $bannedcache[$uid];
$mybb->user['bandate'] = $banned_user['dateline'];

Zeile 173Zeile 151
			if($mybb->user['unreadpms'] == -1)
{
$update += 2;

			if($mybb->user['unreadpms'] == -1)
{
$update += 2;

			}


			}


			require_once MYBB_ROOT."inc/functions_user.php";
$pmcount = update_pm_count('', $update);
if(is_array($pmcount))
{
$mybb->user = array_merge($mybb->user, $pmcount);
}

			require_once MYBB_ROOT."inc/functions_user.php";
$pmcount = update_pm_count('', $update);
if(is_array($pmcount))
{
$mybb->user = array_merge($mybb->user, $pmcount);
}

		}

		}

		$mybb->user['pms_total'] = $mybb->user['totalpms'];
$mybb->user['pms_unread'] = $mybb->user['unreadpms'];

if($mybb->user['lastip'] != $this->ipaddress && array_key_exists('lastip', $mybb->user))
{

		$mybb->user['pms_total'] = $mybb->user['totalpms'];
$mybb->user['pms_unread'] = $mybb->user['unreadpms'];

if($mybb->user['lastip'] != $this->ipaddress && array_key_exists('lastip', $mybb->user))
{

			$lastip_add .= ", lastip='".$db->escape_string($this->ipaddress)."', longlastip='".intval(my_ip2long($this->ipaddress))."'";





			$lastip_add = ", lastip='".$db->escape_string($this->ipaddress)."', longlastip='".intval(my_ip2long($this->ipaddress))."'";
}
else
{
$lastip_add = '';

		}

// If the last visit was over 900 seconds (session time out) ago then update lastvisit.
$time = TIME_NOW;
if($time - $mybb->user['lastactive'] > 900)
{

		}

// If the last visit was over 900 seconds (session time out) ago then update lastvisit.
$time = TIME_NOW;
if($time - $mybb->user['lastactive'] > 900)
{

			$db->shutdown_query("UPDATE ".TABLE_PREFIX."users SET lastvisit='{$mybb->user['lastactive']}', lastactive='$time' {$lastip_add} WHERE uid='{$mybb->user['uid']}'");

			$db->shutdown_query("UPDATE ".TABLE_PREFIX."users SET lastvisit='{$mybb->user['lastactive']}', lastactive='$time'{$lastip_add} WHERE uid='{$mybb->user['uid']}'");

			$mybb->user['lastvisit'] = $mybb->user['lastactive'];
require_once MYBB_ROOT."inc/functions_user.php";
update_pm_count('', 2);

			$mybb->user['lastvisit'] = $mybb->user['lastactive'];
require_once MYBB_ROOT."inc/functions_user.php";
update_pm_count('', 2);

Zeile 202Zeile 184
		else
{
$timespent = TIME_NOW - $mybb->user['lastactive'];

		else
{
$timespent = TIME_NOW - $mybb->user['lastactive'];

			$db->shutdown_query("UPDATE ".TABLE_PREFIX."users SET lastactive='$time', timeonline=timeonline+$timespent {$lastip_add} WHERE uid='{$mybb->user['uid']}'");

			$db->shutdown_query("UPDATE ".TABLE_PREFIX."users SET lastactive='$time', timeonline=timeonline+$timespent{$lastip_add} WHERE uid='{$mybb->user['uid']}'");

		}

// Sort out the language and forum preferences.

		}

// Sort out the language and forum preferences.