downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Voting

Please answer this simple SPAM challenge: one minus zero?
(Example: nine)

The Note You're Voting On

brian at nerdlife dot net
8 years ago
My solution to the logout conondrum:
<?php
if($_GET[op] == 'logout')
{
 
header('WWW-Authenticate: Basic realm="Click \'Ok\' then \'Cancel\' to Log Out"');
 
header('HTTP/1.0 401 Unauthorized');
  echo
'You have been successfully logged out. Click <a href="index.php">here</a> to log back in.');
  die();
}
if(!isset(
$_SERVER[PHP_AUTH_USER]))
{
 
header('WWW-Authenticate: Basic realm="Site Login"');
 
header('HTTP/1.0 401 Unauthorized');
  echo
'You must enter a valid username and password to access this resource.';
  die();
}
else
{
 
//Validate User
 //If Validated:
 
echo "Welcome. <a href='index.php?op=logout'>Logout?</a>"
}
?>
I assume that if the user is reliable enough to even bother logging out, they are reliable enough to click "ok" then "cancel", thereby logging out and displaying the "logged out" message.

<< Back to user notes page

 
show source | credits | stats | sitemap | contact | advertising | mirror sites