Hey,
I am a newbie, trying to produce a login form which will compare the user name and password entered by the user to a database in MySQL which contains a user name and password previously entered in a registration form. At the moment i have code which allows users to pass through to the 'members section' however.. it will allow a user with an invalid password to enter.. here is the code for the login html and php as i have written it:
<html>
<head>
</head>
<body>
<BODY BGCOLOR="teal">
<left>
<img src="http://users.cs.cf.ac.uk/S.J.Crocker/pictures/cardiff.bmp">
</left><br>
<center>
<img src="http://users.cs.cf.ac.uk/S.J.Crocker/pictures/reunited.bmp">
</center>
<form method = "POST" action="members.html" onSubmit="returnverifyform(this)">
<h1> Please enter your password to use member only facilities: </h1>
<br>User Name: <input type = "text" name = "user_name">
<font color="black">*</font><br>
<br>Password: <input type = "password" name = "password">
<font color="black">*</font><br>
<br><input type="submit" name = "enter" value = "Enter">
<input type="reset" name = "clear" value = "Clear">
<li><a href = "register.html">Register Free!!</a></li>
<?php
$connection = mysql_connect("sentinel.cs.cf.ac.uk","scm5sjc",
"MY PASSWORD HERE");
$password=$POST['password'];
$user_name=$POST['user_name'];
$errorMessage = '';
mysql_select_db("sjcdb",$connection) or die("failed!");
if ($row) {
if ($password == $row[9]){
header("Location:members.html");
}
else {
$errorMessage = 'Sorry, wrong user id / password';
echo $errorMessage;
}
}
mysql_close();
?>
</body>
</html>
Any help would be great, cheers