Good morning, all. I'm sort of new at php and have been teaching myself with online tutorials and such. I'm getting the hang of it so far, but last night I ran into a problem that I can't seem to resolve. Here is the code below:
Code:
if ( (strlen($getemail) >= 7) && (strstr($getemail), '@') && (strstr($getemail), '.')){
require("connect.php");
$query = mysql_query("SELECT * FROM members WHERE username='$getuser'");
$numrows = mysql_num_rows($query);
if ($numrows == 0){
$query = mysql_query("SELECT * FROM members WHERE email='$getemail'");
$numrows = mysql_num_rows($query);
if ($numrows == 0){
$password = md5(md5("[salt]".$password."[salt]"));
$date = date('F d, Y');
$code = md5(rand());
mysql_query ("INSERT INTO members VALUES (
'', '$getuser', '$password', '$getemail', '', '$date', '0', '$code', '$getfirstname', '$getlastname', '$lastloginip', '$getbirthmonth', '$getbirthday', $getbirthyear', '$getgender'
)")
$query = mysql_query("SELECT * FROM members WHERE username='$getuser'")
}
else {
$errormsg = "There is already a user with that email address.";
}
}
else {
$errormsg = "There is already a user with that username.";
}
mysql_close();
}
else {
$errormsg = "You must enter a valid email address to register."
}
The error I'm receiving is:
"Parse error: syntax error, unexpected ',' in /[address here]/register.php on line 35"
Line 35 is the very first line in the given code. I don't know what it's trying to tell me.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Thanks, NogDog! That fixed it! There were about 3 more syntax errors after that, but I was able to find them. I ran the code and another problem occurred that I'm unaware of. Whenever I fill out the form and click the submit button, I'm taken to a completely blank version of register.php and I don't know why it doesn't take me back to the form.
$query = mysql_query("SELECT * FROM members WHERE username='$getuser'");
$numrows = mysql_num_rows($query);
if ($numrows == 1){
$site = 'http://localhost';
$webmaster = 'XC Admin <admin@edit.com>';
$headers = 'From: $webmaster';
$subject = 'Trancience: Activate your account';
$message = 'Thanks for registering. Click the link below to activate your account. \n $site/activate.php?user=$getuser&code=$code \n You must activate your account to login.';
if (mail($getemail, $subject, $message, $headers)){
$errormsg = "You have been registered. You must activate your account with the activation link sent to <b>$getemail</b>.";
$getuser = '';
$getemail = '';
}
else
$errormsg = "An error has occurred. Your activation email was not sent.";
}
else
$errormsg = "An error has occurred. Your account was not created.";
}
else
$errormsg = "There is already a user with that email address.";
}
else
$errormsg = "There is already a user with that username.";
mysql_close();
}
else
$errormsg = "You must enter a valid email address to register.";
}
else
$errormsg = "Your passwords did not match.";
}
else
$errormsg = "You must verify your password to register.";
}
else
$errormsg = "You must enter a password to register.";
}
else
$errormsg = "You must enter your email to register.";
}
else
$errormsg = "You must enter your username to register.";
}
else
Bookmarks