Hi all:

If a querystring is set to "Y" I want the session destroyed/variables cleared on a page. I am using the following:

	if ($_GET["sessionEnd"] == "Y"){

	session_start(); //NOTE THIS LINE!
	$_SESSION = array();


	if (ini_get("session.use_cookies")) {
		$params = session_get_cookie_params();
		setcookie(session_name(), '', time() - 42000,
   	 	$params["path"], $params["domain"],
   	 	$params["secure"], $params["httponly"]
		);
	}		

	session_destroy();
session_start();	

} else {

	session_start();
}

However when the line commented NOTE THIS LINE is included in the code it is causing a page loop "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

When I comment out the line the page opens but my variables are still there. I am using PHP 5.3.8 on a Linux box.

Any help appreciated!

    it's working fine ("as expected") for me. Perhaps there is other code that is causing the problem?

      Write a Reply...