Is this the correct way to retrieve a session id for a new or returning visitor? if (!isset($_SESSION)){ session_start(); } if(!isset($_REQUEST['PHPSESSID'])){ $log_session = session_id(); }else{ $log_session = $_REQUEST['PHPSESSID']; } PHP: Thanks
The best way would be just to use $log_session = session_id(); because user can actually modify PHPSESSID using a cookie editor.. so to be safe just user session_id()
Assign a name value to the session, then call that session later in the script. Example: session_start(); if(isset($_SESSION['views'])) $_SESSION['views']=$_SESSION['views']+1; else $_SESSION['views']=1; echo “Pageviews:â€. $_SESSION['views'] Code (markup): Here's where I got the info on sessions: PHP Sessions
Make sure you call session_start() regardless of starting a new session or continuing a previous one.
Great - Thanks! So this ... Is now... session_start(); $log_session = session_id(); PHP: And during testing the php notice "Notice: A session had already been started - ignoring session_start()" can just be suppressed. Thanks again for your help, that has cleared it up.