Thursday, October 18, 2018

php - "Parse error: syntax error, unexpected $end" For my uni registration assignment

I am new to php so I used a Youtube tutorial to create this script, however the uploader seems to have disappeared so I cannot ask him any questions. My login form seems to work fine but the registration form is where I am having trouble




I have removed all html from code and all error else statements to try eliminate the error message but I cant seem to find it. Error always occurs at the end of my script.



Any suggestions



        
if ( $_POST['registerbtn'] ) {
//makes sure email, username is valid
$getuser = $_POST['user'];

$getemail = $_POST['email'];
$getpass = $_POST['pass'];
$getretypepass = $_POST['retypepass'];

if (!isset($getuser))
{
$error = "user not set ";
}

if ($getuser) {

if($getemail) {
if($getpass) {
if ($getretypepass) {
require("connection.php");

$query = mysql_query("SELECT * FROM users WHERE username ='$getuser'");
$numrows = mysql_num_rows($query);
if ($numrows == 0) {
$query = mysql_query("SELECT * FROM users WHERE email ='$getemail'");
$numrows = mysql_num_rows($query);

if ($numrows == 0) {

$password = md5(md5("19Dvdnj".$password."jndfFf20"));
$date = date("F d, Y");
$code = md5(rand());

mysql_query("INSERT INTO users VALUES ('', '$getuser', '$password', '$getmail', '0', '$code', '$date')");

$query = mysql_query("SELECT * FROM users WHERE username='$getuser'");
$numrows =mysql_num_rows($query);

if ($numrows == 1) {

$site ="http://www.inn.leedsmet.ac.uk/~c3314283/iis/register.php";
$webmaster = "admin@leedsmet.com";
$headers = "From: $webmaster";
$subject ="Activate your Account";
$message = "Thanks for registering. Click below to activate your account.\n";
$message .= "$site/activate.php?user=$getuser&code=$code";
$message .= "You must activate your account to login";


if (mail($getmail, $subject, $message, $headers)){
$errormsg = "You have been registered you must activate your account sent from the the activation link sent to$getemail";
$getuser = "";
$getemail = "";
}



mysql_close();






$form ="






























$errormsg
Username:
Email:
Password:
Retype:

";
{
echo $form;
}
?>

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...