I get this error when i added the highlighted text
Parse error: syntax error, unexpected '?' in C:\wamp\www\test\register.php on line 62
Here is the code:
<?php
//Connect to DB
mysql_connect("localhost", "snypeZ", "*****") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());
//Executed if form submitted
if (isset($_POST['submit'])) {
//No Fields are blank
if (!$POST['username'] | !$POST['pass'] | !$_POST['pass2'] ) {
die('You did not complete all of the required fields');
}
// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$POST['username'] = addslashes($POST['username']);
}
$usercheck = $_POST['username'];
$check = mysql_query("SELECT user_name FROM users WHERE user_name = '$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);
//if the name exists it gives an error
if ($check2 != 0) {
die('Sorry, the username '.$_POST['username'].' is already in use.');
}
// this makes sure both passwords entered match
if ($POST['pass'] != $POST['pass2']) {
die('Your passwords did not match.
');
}
// here we encrypt the password and add slashes if needed
$POST['pass'] = md5($POST['pass']);
if (!get_magic_quotes_gpc()) {
$POST['pass'] = addslashes($POST['pass']);
$POST['username'] = addslashes($POST['username']);
$POST['class'] = addslashes($POST['class']);
$POST['email'] = addslashes($POST['email']);
}
//Set time variable
$datejoined = date('Y-m-d H:i:s');
// now we insert it into the database
$insert = "INSERT INTO users (user_name, user_password, user_class, user_email, user_datejoined)
VALUES ('".$POST['username']."', '".$POST['pass']."', '".$POST['class']."', '".$POST['email']."', '".$datejoined."');
$add_member = mysql_query($insert);
?>
<h1>Registered</h1>
<p>Thank you, you have registered at <?php echo $datejoined ?> - you may now login</a>.</p>
<?php
}
else
{
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table border="0">
<tr>
<td>Username:</td>
<td><input type="text" name="username" maxlength="60"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="pass" maxlength="16"></td>
</tr>
<tr>
<td>Confirm Password:</td>
<td><input type="password" name="pass2" maxlength="16"></td>
</tr>
<tr>
<td>Email Address:</td>
<td><input type="text" name="email" maxlength="60"></td>
</tr>
<tr>
<td>Class:</td>
<td> <input type="radio" name="class" value="warrior">Warrior<br>
<input type="radio" name="class" value="Mage">Mage<br>
</td>
</tr>
<tr>
<th colspan=2><input type="submit" name="submit" value="Register"></th>
</tr>
</table>
</form>
<?php
}
?>
I'm sorry I'm not sure how to put the Code block in.