Jump to content

logging out with cookies


pneudralics

Recommended Posts

Everytime I logout and go to the url and type in localhost/logout.php I else statement which I shouldn't get unless I just logged out. I can type in localhost/logout.php all day and it'll show my else statement.

 

But if I refresh the page I'll finally get my error.php. How do I fix it so after I logout and I type in localhost/logout.php it'll show the error page instead of showing that I just logged out.

 

The below is my logout.php

<?php
ob_start();
if(!isset($_COOKIE['id']) && !isset($_COOKIE['idsession']) && !isset($_COOKIE['ip'])){
include ('c/connect.php');
include ('header.php');	
include ('sideleft.php');
?>
<div id="maincolumn">
<?php
require ("error.php");
?>
</div>
<?php    
include ('footer.php');	 
} else { 
include ('c/connect.php');
include ('header.php');
setcookie('id', '');
setcookie('id', '', time() -3600);
setcookie('idsession', '');
setcookie('idsession', '', time() -3600);
setcookie('ip', '');
setcookie('ip', '', time() -3600);
ob_flush();
?>
<?php
include ('sideleft.php');
?>

<div id="maincolumn">
<div class="text">
You have successfully logged out of HappyProfile.com
<br />
Thanks for visiting and come back soon!
<br />
<a href="login.php" style="font-weight:bold;">Log Back In</a>
</div>
</div>
<?php
include ('footer.php');
}//End session else
?>

Link to comment
https://forums.phpfreaks.com/topic/159666-logging-out-with-cookies/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.