pneudralics Posted May 26, 2009 Share Posted May 26, 2009 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 More sharing options...
gevans Posted May 26, 2009 Share Posted May 26, 2009 Get rid of ob_start() and ob_flush(), it's completely unnecessary on a script of that size. Link to comment https://forums.phpfreaks.com/topic/159666-logging-out-with-cookies/#findComment-842164 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.