Hallo,
Ik heb de volgende pagina gemaakt, maar krijg de volgende error:
[13-Jul-2009 03:45:17] PHP Parse error: syntax error, unexpected '}' in C:\Program Files\Zend\Apache2\htdocs\register.php on line 7
Weet iemand hier raad mee? Bedankt zover!
<?php
require_once('Connections/Leagues.php');
//Check if user is already logged in
if(isset($_SESSION['USERID'])){header('location: msg.php?msg=alreadyloggedin')};
if($_SERVER['REQUEST_METHOD'] == 'POST'){
if(isset($_POST['submit'])){
//Convert Vars
$username = $_POST['username'];
$password = $_POST['password'];
$password1 = $_POST['password1'];
$email = $_POST['email'];
$email1 = $_POST['email1'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$age = $_POST['age'];
$gender = $_POST['gender'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$postelcode = $_POST['postelcode'];
$country = $_POST['country'];
$newsletter = $_POST['newsletter'];
$termsagreed = $_POST['termsagreed'];
$ip = $_SERVER['REMOTE_ADDR'];
$level = $_POST['level'];
//Check if required vars are filled
if(empty($username)){header('location: msg.php?msg=enterusername')};
if(empty($password)){header('location: msg.php?msg=enterpassword')};
if(empty($password1)){header('location: msg.php?msg=enterpassword1')};
if(empty($email)){header('location: msg.php?msg=enteremail')};
if(empty($email1)){header('location: msg.php?msg=enteremail1')};
if(empty($firstname)){header('location: msg.php?msg=enterfirstname')};
if(empty($lastname)){header('location: msg.php?msg=enterlastname')};
if(empty($age)){header('location: msg.php?msg=enterage')};
if(empty($gender)){header('location: msg.php?msg=entergender')};
if(empty($termsagreed)){header('location: msg.php?msg=entertermsagreed')};
if(empty($ip)){header('location: msg.php?msg=iperror')};
//Check if required vars have there lengt
if(strlen($username) > 4){header('location: msg.php?msg=usernameshort')};
if(strlen($password) > 4){header('location: msg.php?msg=passwordshort')};
if(strlen($password1) > 4){header('location: msg.php?msg=password1short')};
if(strlen($email) > 6){header('location: msg.php?msg=emailshort')};
if(strlen($email1) > 6){header('location: msg.php?msg=email1short')};
if(strlen($firstname) > 2){header('location: msg.php?msg=firstnameshort')};
if(strlen($lastname) > 2){header('location: msg.php?msg=lastnameshort')};
//Check if vars are confirmed
if($password != $password1){header('location: msg.php?msg=passwordnoconfirm')};
if($email != $email){header('location: msg.php?msg=emailnoconfirm')};
//Check if vars already exists
$result = mysql_result(mysql_query("SELECT COUNT(1) FROM users WHERE username = '$username'"),0);
if(!empty($resultaat)){header('location: msg.php?msg=usernameinuse')};
$result = mysql_result(mysql_query("SELECT COUNT(1) FROM users WHERE email = '$email'"),0);
if(!empty($resultaat)){header('location: msg.php?msg=emailinuse')};
$result = mysql_result(mysql_query("SELECT COUNT(1) FROM users WHERE ip = '$ip'"),0);
if(!empty($resultaat)){header('location: msg.php?msg=ipinuse')};
//Generate activation var
$actcode = mt_srand((double)microtime()*100000);
while(strlen($actcode) <= 10)
{
$i = chr(mt_rand(0,255));
if(eregi('^[a-z0-9]$', $i))
{
$actcode = $actcode.$i;
}
}
//Var insert query
rquery = "INSERT INTO users (username, password, email, firstname, lastname, age, gender, address, address1, city, postelcode, country, newsletter, termsagreed, ip, level, actcode) VALUES
('".mysql_real_escape_string($username)."', '".mysql_real_escape_string(sha1(($password))."', '".mysql_real_escape_string($email)."', '".mysql_real_escape_string($firstname)."', '".mysql_real_escape_string($lastname)."', '".mysql_real_escape_string($age)."', '".mysql_real_escape_string($gender)."', '".mysql_real_escape_string($address)."', '".mysql_real_escape_string($address1)."', '".mysql_real_escape_string($city)."', '".mysql_real_escape_string($postelcode)."', '".mysql_real_escape_string($country)."', '".mysql_real_escape_string($newsletter)."', '".mysql_real_escape_string($termsagreed)."', '".mysql_real_escape_string($ip)."', '".mysql_real_escape_string($level)."', '".mysql_real_escape_string($actcode)."')";
//RQuery result
$rresultaat = mysql_query($rquery);
//If rquery fails
if(!$rresultaat){
header('location: msg.php?msg=registerqfail')
}
else
{
//E-Mail the user his act var
$receiver = $email;
$subject = 'Account Activation';
$headers = 'From: no-reply@'.$leaguesdomain.'' . "\r\n" .
'Reply-To: no-reply@'.$leaguesdomain.'' . "\r\n" .
'MIME-Version: 1.0' . "\r\n" .
'Content-Type: text/html; charset=ISO-8859-1' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
'X-Priority: 1' . "\r\n" .
$msg = '<h3>Profiel Aangemaakt</h3>
Dear '.$firstname.' '.$lastname.' aKa '.$username.',<br />
You just registered an account on '.$leaguesfullname.' with the following information:
<h3>Account Information</h3>
<p>Username: '.$username.'<br />
Password: '.$password.'</p>
<h3>Account Activation</h3>
<p>You need to activate your account to play battles on '.$leaguesfullname.'.<br />
You can click the following url to activate your account.</p>
<p>Activation: <a href="'.$leaguesaddress.'/activate.php?username='.$username.'&actcode='.$actcode.'">'.$leaguesaddress.'/activate.php?username='.$username.'&actcode='.$actcode.'</a></p>';
//Sent E-mail to user
mail($receiver, $subject, $msg, $headers);
//User registered, Re-Locate client
header('location: msg.php?msg=registersucces')
}
}
?>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST" name="register" id="register">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="left">Username:*</td>
<td align="center"><input type="text" name="username" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">Password:*</td>
<td align="center"><input type="password" name="password" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">Password: (Confirm)*</td>
<td align="center"><input type="password" name="password1" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">E-Mail:*</td>
<td align="center"><input type="text" name="email" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">E-Mail: (Confirm)*</td>
<td align="center"><input type="text" name="email1" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">First Name:*</td>
<td align="center"><input type="text" name="firstname" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">Last Name:*</td>
<td align="center"><input type="text" name="lastname" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">Age:*</td>
<td align="center"><input type="text" name="age" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">Gender:*</td>
<td align="center"><select name="gender">
<option value="male" <?php if (!(strcmp("male", ""))) {echo "SELECTED";} ?>>Male</option>
<option value="female" <?php if (!(strcmp("female", ""))) {echo "SELECTED";} ?>>Female</option>
</select></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">Address Line 1:</td>
<td align="center"><input type="text" name="address1" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">Address Line 2:</td>
<td align="center"><input type="text" name="address2" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">City:</td>
<td align="center"><input type="text" name="city" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">Postelcode:</td>
<td align="center"><input type="text" name="postelcode" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">Country:</td>
<td align="center"><input type="text" name="country" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">Newsletter:</td>
<td align="center"><select name="newsletter">
<option value="yes" <?php if (!(strcmp("yes", ""))) {echo "SELECTED";} ?>>Yes, Please sent me the montly newsletter.</option>
<option value="no" <?php if (!(strcmp("no", ""))) {echo "SELECTED";} ?>>No, I do not want to receive the montly newsletter</option>
</select></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">Termsagreed:*</td>
<td align="center"><select name="termsagreed">
<option value="no" <?php if (!(strcmp("no", ""))) {echo "SELECTED";} ?>>No, I do not agree with the Terms of Service</option>
<option value="yes" <?php if (!(strcmp("yes", ""))) {echo "SELECTED";} ?>>Yes, I agree with the Terms of Service</option>
</select></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="left">Ip:</td>
<td align="center"><b><?php echo $_SERVER['REMOTE_ADDR']; ?></b></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="center" colspan="2"><input type="submit" value="Register" name="submit"/></td>
</tr>
</table>
<input type="hidden" name="userid" value="" />
<input type="hidden" name="level" value="user" />
<input type="hidden" name="MM_insert" value="register" />
</form>
<p> </p>
891 views