HomeWatched TopicsRegisterSearchDirectory
FAQMemberlistUsergroupsLog inStoresItemsBank

Reply to topic Page 1 of 1
I am having PARSE ERROR....CAN somebody PLEASE HELP???
Message  

Reply with quote
Post I am having PARSE ERROR....CAN somebody PLEASE HELP??? 
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
View user's profile Send private message

Reply with quote
Post  
Telling us what the error is would be just great!

Plus I would say that you MUST use md5 to encrypt your passwords.
This means if anyone gains access to your database they cant use it against your users.

Encyrpt the password to md5() when you put it in the database.
Then convert the login password to md5 and use the same method to see if it matches what's in the database.


_________________
http://www.pegproductions.com - Peg Productions Web Design
View user's profile Send private message Send e-mail MSN Messenger

Reply with quote
Post I am having PARSE ERROR....CAN somebody PLEASE HELP??? 
Pezmc I am having parse error on registerme.php, that is the error message i am getting,
between this last tags

?>
</body>
</html>

...I have tried all i know for now since i am new to php code to resolve the issue but can't


_________________
Live your Dream
View user's profile Send private message

Reply with quote
Post  
You have a forgotten a } before the ?>

You opened an else but didn't close it so the PHP fails.

Hope this helps. You should always have the same number of { & }'s


_________________
http://www.pegproductions.com - Peg Productions Web Design
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  




FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Web Hosting
Web Hosting and Dedicated Servers Advertise Here $10 a Month Designer Children
Insurance HGH Domain name registration
Affordable web-hosting Dedicated Server Management

Web Design by PlatinumShore.com & Web Hosting by TradeWebHosting.com