Hello,
I having been some parse error messages with the following registration and login code, especially with the registerme.php script. Below are the codes do see if there are error and if possible correct them for me... Thank you
Register.html......................................................................................
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Register</title>
</head>
<body>
<h1>Register</h1>
<table>
<form action="registerme.php" method="post">
<tr><td width="81">Username:</td>
<td width="247"><input name="username" size="30" autocomplete="off" value="" type="text" /></td></tr>
<tr>
<td>Password:</td>
<td><input name="password" size="30" type="password" /></td></tr>
<tr>
<td>Email:</td>
<td><input name="email" size="30" maxlength="50" type="text"/></td></tr>
<tr>
<td>First Name:</td>
<td><input name="firstname" size="30" type="text" /></td></tr>
<tr>
<td>Last Name:</td>
<td><input name="lastname" size="30" type="text"/></td>
</tr>
<tr><td align="center"><input type="submit" class="button" value="Register" size="20" /></td></tr>
</form>
</table>
</body>
</html>
Register.html......................................................................................
---------------------------------------------------------------------------------------------------
Registerme.php------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Welcome Confirm</title>
</head>
<body>
<?php
include 'mysql_connect.php';
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$result = mysql_num_rows(mysql_query("SELECT * FROM item WHERE username='$username'"));
if($result == 1)
{
echo "<h1>ERROR!</h1>The username you have chosen already exists!";
}
else
{
mysql_query("INSERT INTO item (username, password, email, firstname, lastname)
VALUES ('$username', '$password', '$email', '$firstname', '$lastname')");
echo 'Click <a href="login.php">here</a> to login.';
?>
</body>
</html>
Registerme.php------------------------------------------------------------------------
======================================================
login.php----------------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>login</title>
</head>
<body>
<form name="login" action="login2.php" method="post">
<table align="center"><tr>
<td class="title">Username</td>
<td><input name="user" size="30" autocomplete="off" value="" type="text" /></td>
</tr>
<tr>
<td class="title">Password</td>
<td><input name="pass" size="30" type="password" /></td>
</tr>
<tr><td><p style="text-align:center;"><input type="submit" class="button" value="Login" /></p></td></tr>
</table></form>
</body>
</html>
login.php----------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
login2.php-------------------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login Confirm</title>
</head>
<body>
<?php
include 'mysql_connect.php';
$username = $_POST['user'];
$password = $_POST['pass'];
$query1 = mysql_query("SELECT * FROM item WHERE username='$username'");
$result = mysql_num_rows($query1);
if($result == 0)
{
include '<h1>Error!</h1>The username you specified does not exist!';
}
else
{
$checkuser = mysql_query("SELECT * FROM item WHERE username='$username'");
$row = mysql_fetch_array($checkuser);
$password2 = $row['password'];
$status = $row['status'];
if ($password == $password2)
{
//PUT PASSWORD PROTECTED INFORMATION HERE
}
else
{
echo '<h1>Error!</h1>The username and password combination you entered does not match the ones we have in the database.';
}
}
?>
</body>
</html>
login2.php-------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------
mysql_connection.php--------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
$con = mysql_connect("localhost","hilary","password");
mysql_select_db("game", $con);
?>
</body>
</html>
_________________
Live your Dream



