note 51104 added to features.http-auth

From: Date: Sun, 20 Mar 2005 03:30:30 +0000
Subject: note 51104 added to features.http-auth
Groups: php.notes 
Request: Send a blank email to php-notes+get-86700@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/features.http-auth.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51104 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51104&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51104&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51104&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51104&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51104&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51104&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86700) next »