Ok here's my script :
<?php
$authorized = FALSE;
if ( (isset($SERVER['PHP_AUTH_USER']) AND isset($SERVER['PHP_AUTH_PW'])) ) {
define ('******', 'username');
define ('******', 'password');
define ('localhost', 'localhost');
define ('http://www.PSOrevolution.com', 'sitename');
$dbc = @mysql_connect (localhost, ****, ***) OR die ('Could not connect to MySQL: ' . mysql_error() );
mysql_select_db (hitoshi_web) OR die ('Could not select the database: ' . mysql_error() );
$query = "SELECT first_name FROM users WHERE username='{$SERVER['PHP_AUTH_USER']}' and password=PASSWORD('{$SERVER['PHP_AUTH_PW']}')";
$result = mysql_query ($query);
$row = @mysql_fetch_array ($result);
if ($row) { $authorized = TRUE;
}
}
if (!$authorized) {
header('WWW-Authenticate: Basic realm="Log in to experiance PSO Revolution, where two worlds collide!"');
header('HTTP/1.0 401 Unauthorized');
}
?>
Any ideas whats going wrong here???
I keep on getting the following error :
Could not connect to MySQL: Access denied for user: 'username@localhost' (Using password: YES)
I'm pretty certain there must be only a small error in here. Id be very grateful if someone could point this out for me, ive been trying to find it for ages.
Thanks 🙂