Jump to content

[SOLVED] Logout Help


Ell20

Recommended Posts

Hi,

 

I have the code below, which used to work fine, however I have just changed hosts and now I am getting 2 errors:

 

<?php
if (isset($_SESSION['admin'])) {

header ("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "index.php");
ob_end_clean();
exit();

} else {
/* If user is logged in  */
$_SESSION = array();
session_destroy();
setcookie (session_name(), '', time()-300, '/', '', 0);
}
?>

 

Errors:

Warning: session_destroy() [function.session-destroy]: Trying to destroy uninitialized session in /home/prioryfi/public_html/logout.php on line 11

 

Warning: Cannot modify header information - headers already sent by (output started at /home/prioryfi/public_html/logout.php:11) in /home/prioryfi/public_html/logout.php on line 12

 

Appreciate any help

Link to comment
https://forums.phpfreaks.com/topic/122281-solved-logout-help/
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.