i have this script and it keeps giving me a strange error
Parse error: syntax error, unexpected T_VARIABLE in /var/www/vhosts/""/""/Register.php on line 97
but when i refresh the page it loads normally
(also it doesn't have anything to do with line 97)
the script
<?php
function checkEmail($email) {
list($username,$domain)=split('@',$email);
// checks for if MX records in the DNS
if(!checkdnsrr($domain, 'MX')) {
return false;
}
return true;
}
// Connects to your Database
mysql_connect("localhost", "", "") or die(mysql_error());
mysql_select_db("") or die(mysql_error());
$generated_key="";
//This code runs if the form has been submitted
if (isset($_POST['submit'])) {
//This makes sure they did not leave any fields 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 username FROM users WHERE username = '$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.');
}
//check if the e-mail is already used by somebody else
$mailcheck = $_POST['email'];
$check = mysql_query("SELECT email FROM users WHERE email = '$mailcheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);
//if the name exists it gives an error
if ($check2 != 0) {
die('Sorry, the e-mail '.$_POST['email'].' is already in use.');
}
// this makes sure both passwords entered match
if ($_POST['pass'] != $_POST['pass2']) {
die('Your passwords did not match. ');
}
// this checks if the e-mail they filled in is valid
$email = trim($_POST['email']);
if(!checkEmail($email)) {
die('Please fill in a valid e-mail. ');
}
// this makes sure the captcha code is correct
if ($_POST['security'] != $generated_key) {
die('The security code you entered was wrong. ');
}
// 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']);
}
$from = trim($_POST['email']);
// create the MD5 hash
while (strlen($secret_code) < rand (4,5))
{
$generate = mt_rand(48, 90);
if ($generate < 58 || $generate > 64) $secret_code .= strtolower(chr($generate));
}
$formatted_email = preg_replace("/(-|\@|\.)/", "", $from);
$hashed = md5("$secret_code $formatted_email");
$mail_body = "To validate this email click the following link:\nhttp://www.licrea.nl/game/Validate.php?mail=$from&code=$hashed";
mail($from, "Validation Email", $mail_body, "From: info@yourtalent.com \n");
echo "Please check your email <b>$from</b> for the validation message";
// now we insert it into the database
$insert = "INSERT INTO users (username, password, email, verified ) VALUES ('".$_POST['username']."', '".$_POST['pass']."', '".$_POST['email']."', '$hashed')";
$add_member = mysql_query($insert);
echo "<h1>Registered</h1>";
echo "<p>Thank you, you have registered - you need to verify you're email first to be able to login.</a></p>";
} else {
while (strlen($generated_key) < rand (4,5))
{
$generate = mt_rand(48, 90);
if ($generate < 58 || $generate > 64) $generated_key .= strtolower(chr($generate));
}
global $generated_key;
include("Captcha.php");
?>
<!-- This is what they see before they have registered -->
<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="30">
</td></tr>
<tr><td>Confirm Password:</td><td>
<input type="password" name="pass2" maxlength="30">
</td></tr>
<tr><td>E-mail:</td><td>
<input type="test" name="email" maxlength="60">
</td></tr><br>
<tr><td>Security Check:</td><td>
<?php echo '<img src="captcha.png" alt="">'; ?>
<br><input type="text" name="security" maxlength="10">
</td></tr>
<tr><th colspan=2><input type="submit" name="submit" value="Register"></th></tr> </table>
</form>
<?php
}
?>