OK I've been going over this one all day yet still cant understand why my login won't work 🙁. For your information my database name is pooleflights and the username and passwords (which are beign verified) are in a table called Member in the username and password fields...
I've got the logon page....
<HTML>
<HEAD>
<script type="text/javascript">
function validate()
{
x=document.login
user=x.username.value
submitOK="True"
if (!user)
{
alert("You must enter a username")
submitOK="False"
}
if (submitOK=="False")
{
return false
}
}
</script>
</HEAD>
<BODY>
Please enter your login details
<FORM NAME="login" ACTION="passwordverify.php" METHOD="post" onsubmit="return validate()">
<TABLE BORDER=0>
<TR><TD>Username: </TD><TD> <input type="text" name="username" size=18></TD></TR>
<TR><TD>Password: </TD><TD> <input type="password" name="password" size=18></TD></TR>
<TR><TD COLSPAN="2"><CENTER><input type="reset" name="clear"> <input type="submit" value="Login" name="submit"></TD></TR>
</TABLE>
</form></center>
</BODY>
</HTML>
The PasswordVerify file....
<HTML>
<HEAD>
<LINK REL=stylesheet TYPE="text/css" HREF="main.css">
</HEAD>
<BODY>
<?php
include "common_db.inc";
$linkid = db_connect();
$query = ("SELECT * FROM Member WHERE userid = '$_POST[username]'");
$result = mysql_query($query);
$row = mysql_fetch_array($result);
If ($row["password"] !== $_POST[password])
{
echo ("Incorrect Login. Please try <A HREF=logon.html>again</A>");
}
Else
{
echo ("Welcome $row[username], please <A HREF=main.html>proceed</A> to the main menu");
}
?>
</BODY>
</HTML>
And the common_db.inc file...
<?php
$mySQLHost = "www.sandj.34sp.com";
$mySQLUsername = "sandj";
$mySQLPassword = "cheesetits";
$mySQLDatabaseName = "pooleflights";
function db_connect()
{
$connection = mysql_connect($mySQLHost, $mySQLUsername, $mySQLPassword)
or die("Could not connect to MySQL");
$db = mysql_select_db($mySQLDatabaseName, $connection)
or die("Could not select database");
}
?>
Can anyone help?? This is doing my head in, cheers Rich, Southport.