The login script below appears to connect successfully with the database, but produces the "Access Denied: Are you really you?" message, even though I have put the user details in the relevant table.
I would really appreciate suggestions about where this is going wrong. (None of the site pages have coding that restricts access yet. Could this be the problem?)
<?php
include ('../config.php');
/* get the incoming ID and password hash */
$user = $_POST["yourusername"];
$pass = sha1($_POST["youruserpass"]);
/* establish a connection with the database */
$server = mysql_connect("$dBaseServer", "$dBaseUser",
"$dBasePass");
if (!$server) die(mysql_error());
mysql_select_db("$dBaseName");
/* SQL statement to query the database */
$query = "SELECT * FROM tablename WHERE username = '$user' AND userpass = '$pass'";
/* query the database */
$result = mysql_query($query);
/* Allow access if a matching record was found, else deny access. */
if (mysql_fetch_row($result))
echo "Access Granted: Welcome, $user!";
else
echo "Access Denied: Are you really you?";
mysql_close($server);
?>