Jump to content

Signup code help


graham23s

Recommended Posts

Hi Guys,

 

I can't figure this one out, in my registration code i set it to email when a user successfully registers:

 

code:

 

<?php
if (isset($_POST['submitSignUp']))
{
   // Errors array()
   $errors = array();

   // POST vars
   $fName = mysql_real_escape_string($_POST['fname']);
   $lName = mysql_real_escape_string($_POST['lname']); 
   $email = mysql_real_escape_string($_POST['email']); 
   $pass1 = mysql_real_escape_string($_POST['pass1']); 
   $pass2 = mysql_real_escape_string($_POST['pass2']); 
   $cntry = mysql_real_escape_string($_POST['cntry']); 
   
   // Does passwords match
   if ($pass1 != $pass2)
   {
      $errors[] = "Your passwords don't match."; 
   }
   
   // Potential errors 
   // Empty fields
   if (empty($fName) || empty($lName) || empty($email) || empty($pass1) || empty($pass2)) { 
        $errors[] = "You never filled in all the fields."; 
   } else {
    
       // Does user exist? 
       $result = mysql_query("SELECT * FROM `dig_customers` WHERE `email`='$email' LIMIT 1"); 
       if (mysql_num_rows($result) > 0) {    
          $errors[] = "The e-mail address <b>$email</b> has already been registered.";  
       } else {

       // Empty for now...

       }
   }  
   
   // display errors if any exist
   if (count($errors) > 0) 
   { 
       print "<div id=\"errorMsg\"><h3>Ooops! There was error(s)</h3><ol>"; 
       foreach($errors as $error) 
       { 
          print "<li>$error</li>"; 
       }
       print "</ol></div>";
   } else {
       print "<div id=\"okMsg\"><p>All done  you can now sign in.</p></div>";
       
         // Encrypt the password before insertion
         $encPass = md5($pass1);

         // Insert into the database
         $q = mysql_query("INSERT INTO `dig_customers` 
         
         (`id`,
          `password`,
          `password_unencrypted`,
          `gender`,
          `title`,
          `first_name`,
          `last_name`,
          `address`,
          `city`,
          `state_county`,
          `post_zip_code`,
          `country`,
          `email`,
          `home_number`,
          `mobile_number`,
          `news_letter`,
          `special_offers`,
          `admin_level`,
          `registered`) 
         
           VALUES 
          
          ('',
          '$encPass',
          '$pass1',
          'NULL',
          'NULL',
          '$fName',
          '$lName',
          'NULL',
          'NULL',
          'NULL',
          'NULL',
          '$cntry',
          '$email',
          'NULL',
          'NULL',
          'NULL',
          'NULL',
          'N',
           NOW())");

          if ($q)
          {

            // Alert on signup
            send_graham_email("User Has Signed Up!");
          
          }
       
   }

}
?>

 

i moved this part: print "<div id=\"okMsg\"><p>All done :) you can now sign in.</p></div>"; and the INSERT query to where it is now thinking this has solved it, but i just got an email saying "user has signed up!" but when i check the stats they haven't LOL

 

can anyone see where i have went wrong?

 

cheers guys

 

Graham

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.