Jump to content

Unexpected T_else????


Marine50x

Recommended Posts

Hey Guys

 

I'm making a register page for my site everything is going well besides this one else statement!!!! Can Anyone Help!!!

 


Error:

Parse error: syntax error, unexpected T_ELSE in /home/content/m/a/r/marine50x/html/register.php on line 225 :confused:

 

Code:

<?php
session_start ();

$errorMsg = "";
$firstname = "";
$lastname = "";
$country = "";
$state = "";
$city = "";
$zip = "";
$website = "";
$youtube = "";
$email1 = "";
$email2 = "";
$pass1 = "";
$pass2 = "";
$gamertag = "";
$psnid = "";
$username = "";

// This code runs only if the form submit button is pressed
if (isset ($_POST['firstname'])){

/* Example of cleaning variables in a loop
$vars = "";
foreach ($_POST as $key => $value) {
       $value = stripslashes($value);
       $vars .= "$key = $value<br />";
    }
    print "$vars";
    exit();
*/
     $firstname = $_POST['firstname'];
     $lastname = $_POST['lastname'];
     $country = $_POST['country'];
     $state = $_POST['state'];
     $city = $_POST['city'];
     $zip = $_POST['zip'];
     $website = $_POST['website'];
     $youtube = $_POST['youtube'];
     $email1 = $_POST['email1'];
     $email2 = $_POST['emailsec'];
     $pass1 = $_POST['pass1'];
     $pass2 = $_POST['pass2'];
     $humancheck = $_POST['humancheck'];
 $gamertag = $_POST['gamertag'];
 $psnid = $_POST['psnid'];
 $username = $_POST['username'];

 $firstname = stripslashes($firstname);
     $lastname = stripslashes($lastname);
     $state = stripslashes($state);
     $city = stripslashes($city);
     $zip = stripslashes($zip);
     $website = stripslashes($website);
     $youtube = stripslashes($youtube);
     $email1 = stripslashes($email1); 
     $pass1 = stripslashes($pass1); 
     $email2 = stripslashes($emailsec);
     $pass2 = stripslashes($pass2);
 $gamertag = stripslashes($gamertag);
 $psnid = stripslashes($psnid);
 $username = stripslashes($username);


     $firstname = strip_tags($firstname);
 $lastname = strip_tags($lastname);
     $state = strip_tags($state);
     $city = strip_tags($city);
 $zip = strip_tags($zip);
     $website = strip_tags($website);
     $youtube = strip_tags($youtube);
     $email1 = strip_tags($email1);
     $pass1 = strip_tags($pass1);
     $email2 = strip_tags($emailsec);
     $pass2 = strip_tags($pass2);
 $gamertag = strip_tags($gamertag);
 $psnid = strip_tags($psnid);
 $username = strip_tags($username);

    
     // Connect to database
     require_once "scripts/connect_to_mysql.php";

     $emailCHecker = mysqli_real_escape_string($myConnection,$email1);
 $emailCHecker = ereg_replace("`", "", $emailCHecker);
     // Database duplicate e-mail check setup for use below in the error handling if else conditionals
     $sql_email_check = mysqli_query($myConnection,"SELECT email FROM members WHERE email='$emailCHecker'");
     $email_check = mysqli_num_rows($sql_email_check); 

     // Error handling for missing data
     if ((!$firstname) || (!$lastname) || (!$country) || (!$state) || (!$city) || (!$zip) || (!$email1) || (!$emailsec) || (!$pass1) || (!$pass2) || (!$username)) { 

     $errorMsg = 'ERROR: You did not submit the following required information:<br /><br />';

  
     if(!$firstname){ 
       $errorMsg .= ' * First Name<br />';
     } 
 if(!$lastname){ 
       $errorMsg .= ' * Last Name<br />';
     } 
     if(!$country){ 
       $errorMsg .= ' * Country<br />';
     } 	
 if(!$state){ 
       $errorMsg .= ' * State or Provice<br />';      
     }
 if(!$city){ 
       $errorMsg .= ' * City<br />';        
     } 
 if(!$zip){ 
       $errorMsg .= ' * Postal or Zip Code<br />';       
 } 	
  if(!$username){ 
       $errorMsg .= ' * Username<br />';  

     } 		
 if(!$email1){ 
       $errorMsg .= ' * Email Address<br />';           
     }        	  	
  if(!$email2){ 
       $errorMsg .= ' * Confirm E-mail<br />';  
 }
 if(!$pass1){ 
       $errorMsg .= ' * Login Password<br />';      
     }
 if(!$pass2){ 
       $errorMsg .= ' * Confirm Login Password<br />';        
     } else if ($email1 != $email2) {
              $errorMsg = 'ERROR: Your Email fields below do not match<br />';
     } else if ($pass1 != $pass2) {
              $errorMsg = 'ERROR: Your Password fields below do not match<br />';
     } else if ($humancheck != "") {
              $errorMsg = 'ERROR: The Human Check field must be cleared to be sure you are human<br />';		 
     } else if ($email_check > 0){ 
              $errorMsg = "<u>ERROR:</u><br />Your Email address is already in use inside our database. Please use another.<br />"; 
   
     } else { // Error handling is ended, process the data and add member to database
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 $firstname = mysqli_real_escape_string($firstname);
 $lastname = mysqli_real_escape_string($lastname);
     $state = mysqli_real_escape_string($state);
     $city = mysqli_real_escape_string($city);
 $zip = mysqli_real_escape_string($zip);
     $website = mysqli_real_escape_string($website);
 $youtube = mysqli_real_escape_string($youtube);
     $email1 = mysqli_real_escape_string($email1);
     $pass1 = mysqli_real_escape_string($pass1);
 $username = mysqli_real_escape_string($username);
 $gamertag = mysqli_real_escape_string($gamertag);
 $psnid = mysqli_real_escape_string($psnid);

 $firstname = eregi_replace("`", "", $firstname);
 $lastname = eregi_replace("`", "", $lastname);
 $state = eregi_replace("`", "", $state);
 $city = eregi_replace("`", "", $city);
 $zip = eregi_replace("`", "", $zip);
 $website = eregi_replace("`", "", $website);
 $youtube = eregi_replace("`", "", $youtube);
 $email1 = eregi_replace("`", "", $email1);
 $pass1 = eregi_replace("`", "", $pass1);
 $gamertag = eregi_replace("`", "", $gamertag);
 $username = eregi_replace("`", "", $username);
 $psnid = eregi_replace("`", "", $psnid);



     $website = eregi_replace("http://", "", $website);
 $youtube = eregi_replace("http://www.youtube.com/user/", "", $youtube); 

     // Add MD5 Hash to the password variable
     $db_password = md5($pass1); 

     // Add user info into the database table for the main site table(audiopeeps.com)
     $sql = mysqli_query($myConnection,"INSERT INTO members (firstname, lastname, country, state, city, zip, email, password, sign_up_date, website, youtube, username, gamertag, psnid) 
     VALUES('$firstname','$lastname','$country','$state','$city','$zip','$email1','$db_password', now(),'$website','$youtube', '$username', '$gamertag', '$psnid')")  
     or die (mysqli_error());

     $id = mysqli_insert_id();

 // Create directory(folder) to hold each user's files(pics, MP3s, etc.)		
     mkdir("members/$id", 0755);	

    //!!!!!!!!!!!!!!!!!!!!!!!!!    Email User the activation link    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    $to = "$email1";

    $from = "[email protected]";
    $subject = "Complete yourdomain registration";
    //Begin HTML Email Message
    $message = "Hi $firstname,

   Complete this step to activate your login identity at WowEvocation.

   Click the line below to activate when ready.

   http://www.wowevocation.com/activation.php?id=$id&sequence=$db_password
   If the URL above is not an active link, please copy and paste it into your browser address bar

   <b>Login after successful activation using your: </b> 
   E-mail Address: $email1 
   Password: $pass1

   See you on the site!
   [email protected]";
   //end of message
$headers  = "From: $from\r\n";
    $headers .= "Content-type: text\r\n";

    mail($to, $subject, $message, $headers);

   $msgToUser = "<h2>One Last Step - Activate through Email</h2><h4>OK $firstname, one last step to verify your email identity:</h4><br />
   In a moment you will be sent an Activation link to your email address.<br /><br />
   <br />
   <strong><font color=\"#990000\">VERY IMPORTANT:</font></strong> 
   If you check your email with your host providers default email application, there may be issues with seeing the email contents.  If this happens to you and you cannot read the message to activate, download the file and open using a text editor. If you still cannot see the activation link, contact site admin and briefly discuss the issue.<br /><br />
   ";


   include_once 'msgToUser.php'; 

   exit();

   } else {  //LINE 225

$errorMsg = "Fields marked with an [ * ] are required";
$firstname = "";
$lastname = "";
$country = "";
$state = "";
$city = "";
$zip = "";
$website = "";
$youtube = "";
$email1 = "";
$email2 = "";
$pass1 = "";
$pass2 = "";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/189591-unexpected-t_else/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.