ok this what Im trying to do, on index.php I want it to get a variable from the query string lets call it id. If its there a session should start and a session variable should be set. this part works and eventualy there will be more code to pull out the id from a database.
index.php
Code:
if(isset($_GET['id'])){
 session_start();
 $_SESSION['id'] = 'user_id';
}
on another page.php it should check for the session variable and if the session variable is not set the session should end and invalidate the cookie from the client machine
another_page.php
Code:
session_start();
if(isset($_SESSION['id'])){
 echo $_SESSION['id'];
 
}
else {
 // empty the $_SESSION array
  $_SESSION = array();
  // invalidate the session cookie
  if (isset($_COOKIE[session_name()])) {
    setcookie(session_name(), '', time()-86400, '/');
  }
  // end session and redirect
  session_destroy();
}
this is where I am having the trouble Im testing this on my localhost and the cookie is not being deleted. Any ideas, is my code correct.
thanks for the help