when i try to access that page now i get this error
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (2) in /home/theuther/public_html/includes/auth/auth.php on line 24
Warning: mysql_select_db(): Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (2) in /home/theuther/public_html/includes/auth/auth.php on line 25
Warning: mysql_select_db(): A link to the server could not be established in /home/theuther/public_html/includes/auth/auth.php on line 25
Query failed: Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (2)
however when i try mypage.php?logout=1
i get the http auth form, but i cant log in
code
<?
function logged_in() {
if (!empty($_GET['logout'])) {
$_SERVER['PHP_AUTH_USER'] = false;
}
return $_SERVER['PHP_AUTH_USER'] !== false;
}
if (!logged_in()) {
header('WWW-Authenticate: Basic realm="theutherfish.com : Admin"');
header('HTTP/1.0 401 Unauthorized');
echo '<h2>ERROR : You Must Log In To Access The Control Panel</h2>';
exit;
}
else {
$dblink=mysql_connect($dbserver,$dbreaduser,$dbreadpass);
$db_sel = mysql_select_db($db) or die("Query failed: " . mysql_error());
$query="SELECT `password` FROM ".$usertable." WHERE username = '".$_SERVER['PHP_AUTH_USER']."'";
$queryresult = mysql_query($query,$dblink) or die(mysql_error());
$row = mysql_fetch_array($queryresult);
if (md5($_SERVER['PHP_AUTH_PW']) == $row['password']) {
}
else {
header('WWW-Authenticate: Basic realm="theutherfish.com : Admin"');
header('HTTP/1.0 401 Unauthorized');
echo '<h2>ERROR : You Must Log In To Access The Control Panel</h2>';
exit;
}
}
?>
thanks