Jump to content

Registration form help


graham23s

Recommended Posts

Hi Guys,

 

This is really stumping me here lol i have set my registration page code to email me when a user signs up (once its entered in the database)

 

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!");
          
          }
       
   }

}
?>

 

When i do a test signup on: http://www.digicures.com/sign-up.php everything works great i get an email and the entry is saved in the database, over the paste week or so i have had about 8 emails saying people have signed up but when i check the database there nothing there!

 

i can't understand it, only when the insert query is true should it send me the mail eh?

 

can anyone see any problems with the code at all?

 

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.