Forum Moderators: coopster
Notice: Undefined variable: PHP_AUTH_USER in c:\inetpub\wwwroot\gsssecure\index.php on line 17
Notice: Undefined variable: PHP_AUTH_PW in c:\inetpub\wwwroot\gsssecure\index.php on line 18
And below is the script (the lines it refers to are bold)
<?$auth = false; //asumes not authenticated
if (!isset ($PHP_AUTH_USER) &&!isset($PHP_AUTH_PW)) {
// connect to mysql
mysql_connect('localhost','rootuser','rootadmin')
or die ('Unable to connect at this time to the server');
// select the DB table
mysql_select_db('DATABASE')
or die ('Unable to find the database you requested');
// create the query
$sql = "Select * from USERS where
[b]username = '$PHP_AUTH_USER' AND
password = '$PHP_AUTH_PW'";[/b]
// execute query
$result = mysql_query ($sql)
or die('Unable to execute query');
// get number of rows in $result
$num = mysql_numrows($result);
if ( $num!=0 ) {
// a matching row was found
$auth = true;
}
}
if (! $auth) {
header('WWW-Authenticate: Basic realm="Private"');
header('HTTP/1.0 401 Unauthorised');
echo 'Authorisation Required';
exit;
} else {
echo "<p>You are now logged in </p>";
}
?>
Now, i've read on the net that i may need to configure IIS to use ISAPI filters (i only installed the .exe without any altering any other settings) is this true?
Any tips or sugestions most helpful at this stage.
Thanks
Dan
[us2.php.net...]
The last couple of paragraphs on the HTTP authentication with PHP [php.net] page shed some light on IIS/ISAPI usage as well.
[edited by: coopster at 11:41 am (utc) on Nov. 11, 2004]
[edit reason] no urls as per TOS [webmasterworld.com] [/edit]