|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-12-13 03:39 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 03:00:01 2025 UTC |
i included the following code in one file. <?php if(!isset($PHP_AUTH_USER)) { header('WWW-Authenticate: Basic Realm="Enter your login name and password"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization required'; exit; } else { require("mysqlconn.inc"); $sql = "select password from users where username = '$PHP_AUTH_USER'"; $result = mysql_query($sql,$conn); $row = mysql_fetch_array($result); if($PHP_AUTH_PW != $row[0]) { header('WWW-Authenticate: Basic Realm="Authorization failed : Enter Username and password"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization required'; mysql_free_result($result); mysql_close(); exit; } mysql_free_result($result); mysql_close(); } ?> I have included the following code to logout the user <? unset($PHP_AUTH_USER); ?> but it's not destroying the variable $PHP_AUTH_USER.