View Single Post
Old 03-03-2008, 07:09 PM   #3 (permalink)
StevenF
The Contributor
 
Join Date: Jan 2008
Posts: 87
Thanks: 49
StevenF is on a distinguished road
Default

Oh so, so would something like this work instead?

If login = true

PHP Code:
//Start the session
session_start();
//Create session cookie
// Set cookie
setcookie("loggedin""TRUE"time()+(3600 24));
//let's grab the session ID for those who don't have cookies
$id session_id(); 
$url "Location: myaccount.php?sid=" $id;
header($url); 
else

PHP Code:
session_start(); 
session_unset();
session_destroy();
unset(
$id);
// expire cookie
setcookie ("loggedin"""time() - 3600);  
echo (
"Logging Out...");
header('Refresh: 1; url=index.php'); 
$id is storing the session_id.

Would that work? Also, what would replace $value?

Edit: That wouldn't work. As I said in the first post:

Quote:
Originally Posted by php.net
Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including <html> and <head> tags as well as any whitespace.
__________________
My Personal and Photo Blog

Last edited by StevenF : 03-03-2008 at 08:03 PM.
StevenF is offline  
Reply With Quote