Location: PHPKode > projects > ZAPms > zap/include/sess.php
<?php
//------------------------------------------------------------
// Insert session ID to url
function appendSid($url, $non_html_amp = false) {
	global $SID;
	if ( !empty($SID) && !preg_match('#sid=#', $url) ) {
		$url .= ( ( strpos($url, '?') != false ) ?  ( ( $non_html_amp ) ? '&' : '&amp;' ) : '?' ) . $SID;
	}
	return $url;
}
//------------------------------------------------------------
function sess_is_registered($id) {
	$sess_file = SESS_DIR.'sess_'.$id;
	return(file_exists($sess_file));
}
//------------------------------------------------------------
function sess_read($id) {
	$sess_file = SESS_DIR.'sess_'.$id;
	if ($fp = @fopen($sess_file, 'r')) {
		$sess_data = fread($fp, filesize($sess_file));
		return($sess_data);
	} else {
		return('');
	}
}
//------------------------------------------------------------
function sess_write($id, $sess_data) {
	$sess_file = SESS_DIR.'sess_'.$id;
	if ($fp = @fopen($sess_file, 'w')) {
		return(fwrite($fp, $sess_data));
	} else {
		return(false);
	}
}
//------------------------------------------------------------
function sess_destroy($id) {
	global $sess_save_path, $sess_session_name;
	$sess_file = SESS_DIR.'sess_'.$id;
	return(@unlink($sess_file));
}
//------------------------------------------------------------
function sess_update() {
	global $sid, $auth_id, $auth_var1, $auth_var2, $auth_var3, $auth_var4, $auth_var5;
	
	$auth_time = time();
	$auth_info = $auth_id.'#'.$auth_time.'#'.$auth_var1.'#'.$auth_var2.'#'.$auth_var3.'#'.$auth_var4.'#'.$auth_var5;
	//print 'id='.$auth_id;
	sess_write($sid, $auth_info);
}
//------------------------------------------------------------

?>
Return current item: ZAPms