function __construct() { parent::__construct(); session_start(); if ($_SESSION['username']) { $this->username = $_SESSION['username']; $this->user_id = $_SESSION['user_id']; } }
function __construct() { parent::__construct(); global $nodejs_memcache_server; if (!is_array($nodejs_memcache_server)) { die(json_encode(array('r' => 'error', 'e' => 'server misconfigured'))); } $this->memcache = memcache_connect($nodejs_memcache_server[0], $nodejs_memcache_server[1]); $cookie = json_decode($_COOKIE[COOKIE_NAME]); if ($cookie) { $session = json_decode($this->memcache->get('session/' . $cookie->sid)); if ($session) { $this->username = $session->username; $this->user_id = $session->user_id; } } }