jasonc310771
01-02-2008, 01:01 PM
i am trying to get the page to revisit itself one the members is logged out, but on refresh it will not try to log them out as they will not be online anymore due to the $user = NULL so the refresh will only run once, but it does not even run the once due to the headers already being sent.
<?php // this file is logout.php
if ($user) {
$res = mysql_query("UPDATE `membersonline` SET `status` = 'LOGGEDOUT' WHERE `user` = '".$user."' LIMIT 1") or die(mysql_error());
mysql_close();
$user = "";
// the rest works but the next line
header ("Refresh: 0; URL=http://site.com/logout.php");
}
?>
<p align="center"> </p>
<p align="center"> </p>
<p align="center">You are no longer logged in.</p>
<p align="center">Thank you for visiting <?=$sitename;?></p>
<p align="center"> </p>
<p align="center"> </p>
<?php // this file is logout.php
if ($user) {
$res = mysql_query("UPDATE `membersonline` SET `status` = 'LOGGEDOUT' WHERE `user` = '".$user."' LIMIT 1") or die(mysql_error());
mysql_close();
$user = "";
// the rest works but the next line
header ("Refresh: 0; URL=http://site.com/logout.php");
}
?>
<p align="center"> </p>
<p align="center"> </p>
<p align="center">You are no longer logged in.</p>
<p align="center">Thank you for visiting <?=$sitename;?></p>
<p align="center"> </p>
<p align="center"> </p>