Hi, Let say someone visits yoursite.com / session-on.php then i want the whole site, no matter which php page visitor visits.... i want this on top session = on and i want it for the maximum period of time. For how long i can do that please insert that in the code you will share with me to help me So, the session on code will be in session-on.php and the <p>Session = on</p> will be added on header.php so it shows on all the pages. Please help if you can. Thanks
<?php session_start(); // This starts the session if(isset($_SESSION['ison'])) { // session is on } else { // session if off } ?> Code (markup): Let's say a visitors goes to the /session-on.php - the session key 'ison' becomes set with the value 'on'. <?php session_start(); // This starts the session $_SESSION['ison'] = "on" ?> Code (markup): For the maximum time: - you must set the cache expire and limiter BEFORE session_start <?php session_cache_limiter('private'); session_cache_expire(90); // 90 minutes - any integer value. session_start(); ?> Code (markup): other way is the change the max lifetime in the function init_set() <?php ini_set("session.gc_maxlifetime", "18000"); session_start(); ?> Code (markup):