0

Hi

I am using the following code to logout:

my logout button calls logout.php

logout.php

<?
session_start();
session_destroy();
header("location:site.php");
?>

This doesnt seem to reidrect to my site.php page, it just loads a blank logout.php page, any ideas?

6
Contributors
8
Replies
9
Views
5 Years
Discussion Span
Last Post by hakeemtunde
0

Make sure there isn't any output (even a newline or white space) before the <? bracket. Hope this helps :)

0

if it's a blank page, there's most likely errors, try putting a error_reporting(E_ALL ^E_NOTICE) on the top of the script

0

I have tried using error_reporting at the top of the script, and it doesnt show up any errors......

0

Is there any script on site.php that checks if a user is logged in or logging out that could redirect back to the logout page?

0

there is a mistake that you can also make when using header() function which is spacing between the full column (:) before the page you are redirecting to e.g

header('Location: page.html');

not

header('Location:page.html');
or
header('Location : page.html');

take note.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.