/home/nondinda/domains/nondindaengcity.go.th/public_html/webboard/test1.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php 

echo "Test session start<br>";
echo 
"1<br>";
ini_set('error_reporting'E_ALL);
ob_start();
session_start();
echo 
"2<br>";
//if ($running=="localhost")
    //    if (session_status() !== PHP_SESSION_ACTIVE) {@session_start();}
//}
echo "3<br>";
if(
$_REQUEST) { extract($_REQUESTEXTR_PREFIX_SAME"request_"); }

echo 
"4<br>";
function 
is_session_started()
{
    if ( 
php_sapi_name() !== 'cli' ) {
        if ( 
version_compare(phpversion(), '5.4.0''>=') ) {
            return 
session_status() === PHP_SESSION_ACTIVE TRUE FALSE;
        } else {
            return 
session_id() === '' FALSE TRUE;
        }
    }
    return 
FALSE;
}

// Example
if ( is_session_started() === FALSE session_start();

echo 
"Test session end";
?>