Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JLEW700

macrumors 6502
Original poster
Aug 12, 2008
353
0
Can somebody please help me find whats wrong with my code. whenever I click on register it says:
Parse error: syntax error, unexpected '{' in /Applications/XAMPP/xamppfiles/htdocs/register.php on line 33

Here is my code:
Code:
<?php
echo "<h1>Register</h1>";

$submit = $_POST['submit'];

$fullname = strip_tags($_POST['fullname']);
$username = strip_tags($_POST['username']);

$password = strip_tags($_POST['password']);
$repeatpassword = strip_tags($_POST['repeatpassword']);
$date = date("y-m-d");


if ($submit)
{

if ($fullname&&$username&&$password&&$repeatpassword)
{

	$password = md5($password);
	$repeatpassword = md5($repeatpassword);

	if ($password==$repeatpassword)
	{
	if (strlen($username)>25||strlen($fullname)>25)
	{
	echo "Length of username or fullname is too long.";

	}
	else
	{
	if (strlen($password)>25||strlen($password<6)
	{
	echo "Password must be between 6 and 25 characters";
	}
	else
	{
	
	echo "success";

		}

	}

}
	else
		echo "Your passwords do not match";

	
}
else
	echo "Please fill in <b>all</b> fields.";

}

?>
<p>

<html>

<form action='register.php' method='POST'>
	<table>
		<tr>
			<td>
			Your full name:
			</td>
			<td>
			<input type='text' name='fullname'>
			</td>
		</tr>
		<tr>
			<td>
			Choose a username:
			</td>
			<td>
			<input type='text' name='username'>
			</td>
		</tr>
		<tr>
			<td>
			Choose a password:
			</td>
			<td>
			<input type='password' name='password'>
			</td>
		</tr>
		<tr>
			<td>
			Repeat your password:
			</td>
			<td>
			<input type='password' name='repeatpassword'>
			</td>
		</tr>
	</table>
	<p>
	<input type='submit' name='submit' value='Register'>

</form>

</html>
 

Coolnat2004

macrumors 6502
Jan 12, 2005
479
4
Take a look at line 33 and the line right above it:
PHP:
if (strlen($password)>25||strlen($password<6)
	{
You're parentheses are unbalanced. You want it to be:
PHP:
if ( strlen($password) > 25 || strlen($password) < 6 )
	{
 

JLEW700

macrumors 6502
Original poster
Aug 12, 2008
353
0
Take a look at line 33 and the line right above it:
PHP:
if (strlen($password)>25||strlen($password<6)
	{
You're parentheses are unbalanced. You want it to be:
PHP:
if ( strlen($password) > 25 || strlen($password) < 6 )
	{

ok, I copied the code you just gave me and it worked, but im not exactly sure whats different about it. Did you just but a bunch of spaces in?
 

yg17

macrumors Pentium
Aug 1, 2004
15,027
3,002
St. Louis, MO
ok, I copied the code you just gave me and it worked, but im not exactly sure whats different about it. Did you just but a bunch of spaces in?


You were missing a closing parenthesis. The number of opening and closing parenthesis should always be equal, you had 3 opening and 2 closing.

Look at the second strlen statement, you were missing a closing one there.
 

JLEW700

macrumors 6502
Original poster
Aug 12, 2008
353
0
You were missing a closing parenthesis. The number of opening and closing parenthesis should always be equal, you had 3 opening and 2 closing.

Look at the second strlen statement, you were missing a closing one there.

after password and before <. got it, thanks guys
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.