Location: PHPKode > projects > Monyet > classes/session.php
<?php

//	singleton pattern for database access

Class Session {
		  
	static private $instance = null;

	private function __construct() {
		session_start();
	}
	public static function getInstance(){
		if(self::$instance == null){
			self::$instance = new Session();
		}
		return self::$instance;
	}

	private function __clone(){}
	function set($key, $var) {
		if (session_is_registered($key) == false) {
			session_register($key);
		}
		$_SESSION[$key] = $var;
		return true;
	}

	public function get($key) {
		if (session_is_registered($key) == false) {
			return false;
		}
		return $_SESSION[$key];
	}

	public function isRegistered($key) {
		return session_is_registered($key);
	}

	public function remove($key) {
		session_unregister($key);
	}
	public function __destruct(){
	}
}
?>
Return current item: Monyet