ways of checking if a session is active

function session_started(){
if(isset(
$_SESSION)){ return true; }else{ return false; }
}

//Start the output buffer so we dont create any errors with headers
ob_start();

//Check to see if it has been started
if(session_started()){
echo
'The session has been started.';
}else{
echo
'The session has not been started.';
}

//Start the session
echo 'Starting Session...';
session_start();

//Check again
if(session_started()){
echo
'The session has been started.';
}else{
echo
'The session has not been started.';
}

//Flush the buffer to screen
ob_end_flush();

Nhận xét

Bài đăng phổ biến từ blog này

Tổng quan về overclock

Intel Core 2 Duo E4300 Review and Overclocking Analysis

Stronger do ca sĩ Inez