Esempio n. 1
0
function signout()
{
	
	kill_cookies();
	session_destroy();

	return array('user'=>array('nickname'=>'','anon'=>true),
	             'ok'=>true, 'error'=>'');
}
Esempio n. 2
0
	function set_anon_user()
	{
		$user = new AnonUser();
		if (isset($_POST['nickname']))
			$user->setNickname(trim($_POST['nickname']));
		else
			$user->setNickname("Anon");
		//$user->setFingerprint("12345");
		$user->loadorsave();
		$_SESSION['user'] = $user;
		return $user;
	}
	
	if (isset($_SESSION['user'])){
		$user = $_SESSION['user'];
		$user->load(true);
	}
	else if (isset($_COOKIE['nickname']) && isset($_COOKIE['password']))
	{
		$result = signin($_COOKIE['nickname'], $_COOKIE['password'], true, 'yes');
		if (isset($_SESSION['user']) && $result['ok']==true)
			$user = $_SESSION['user'];
		else {
			kill_cookies();
			$user = set_anon_user();
		}

	} else
		$user = set_anon_user();
?>