Location: PHPKode > projects > Stelib > stelib-1.2.1/stelib_session.php
<?php
/*
	stelib_session.php [ Libreria Sessioni ]
	Stefano Sangalli
	01 novembre 2004
*/
//!  Session(): oggetto per la connessione con diversi database server.
/*!
	Questo oggetto permette di gestire le variabili di sessione.
*/
class Session extends Page{
	function Session() {		
		$this->sessionStart();
	}
	
	function sessionStart() {		
		return session_start("stelib");
	}
	
	function sessionStop() {
		$result=session_unset("stelib");
		return $result;
	}
	
	function addSessionVar($name,$value) {
		global $_SESSION;
/*
		global $HTTP_SESSION_VARS;
		if (!session_is_registered($name)) {
			if (isset($HTTP_SESSION_VARS)) {
				$HTTP_SESSION_VARS[$name] = $value;
			} elseif (isset($_SESSION)) {
				session_register($name);
				$_SESSION[$name]=$value;
			} else
			$result=1;
		} else {
				$result=-1;
		}  
*/
		session_register($name);
		$_SESSION[$name]=$value;
		return 1;
	}	

	function removeSessionVars($name) {
		if (session_is_registered($name)) {
			$result=session_unregister($name); 
		} else {
			$result=0;
		}
		return $result;
	}

	function getSessionVar($name) {
		if (session_is_registered($name)) {
			$result=$_SESSION[$name]; 
		} else {
			$result=0;
		}
		return $result;
	}
}
?>
Return current item: Stelib