Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6348907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:30:44+00:00 2026-05-24T21:30:44+00:00

Facing a bit of difficulty when trying to integrate the functionality of two different

  • 0

Facing a bit of difficulty when trying to integrate the functionality of two different scripts.

I have a login / registration system that later allows the user to go in and add a profile picture. I want to include the profile image picture upload as a requirement for registration, but am facing difficulty integrating the two.

Here’s where I am at with the php:

 if (isset ($_POST['username'])){

 $username = preg_replace('#[^A-Za-z0-9]#i', '', $_POST['username']); 
 $gender = preg_replace('#[^a-z]#i', '', $_POST['gender']); 
 $b_m = preg_replace('#[^0-9]#i', '', $_POST['birth_month']); 
 $b_d = preg_replace('#[^0-9]#i', '', $_POST['birth_day']);      
 $b_y = preg_replace('#[^0-9]#i', '', $_POST['birth_year']);      
 $email1 = $_POST['email1'];
 $email2 = $_POST['email2'];
 $pass1 = $_POST['pass1'];
 $pass2 = $_POST['pass2'];
 $user_pic = $_POST['user_pic'];

 include_once "scripts/connect_to_mysql.php";
 $emailCHecker = mysql_real_escape_string($email1);
 $emailCHecker = str_replace("`", "", $emailCHecker);
 $sql_uname_check = mysql_query("SELECT username FROM myMembers WHERE username='$username'"); 
 $uname_check = mysql_num_rows($sql_uname_check);
 $sql_email_check = mysql_query("SELECT email FROM myMembers WHERE email='$emailCHecker'");
 $email_check = mysql_num_rows($sql_email_check);

 if ((!$username) || (!$gender) || (!$b_m) || (!$b_d) || (!$b_y) || (!$email1) || (!$email2) || (!$pass1) || (!$pass2) || (!$user_pic)) {

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

 if(!$username){ 
   $errorMsg .= ' * User Name<br />';
 } 
 if(!$gender){ 
   $errorMsg .= ' * Gender: Confirm your sex.<br />';
 }  
 if(!$b_m){ 
   $errorMsg .= ' * Birth Month<br />';      
 }
 if(!$b_d){ 
   $errorMsg .= ' * Birth Day<br />';        
 } 
 if(!$b_y){ 
   $errorMsg .= ' * Birth year<br />';        
 }      
 if(!$email1){ 
   $errorMsg .= ' * Email Address<br />';      
 }
 if(!$email2){ 
   $errorMsg .= ' * Confirm Email Address<br />';        
 }  
 if(!$pass1){ 
   $errorMsg .= ' * Login Password<br />';      
 }
 if(!$pass2){ 
   $errorMsg .= ' * Confirm Login Password<br />';        
 }  
 if(!$user_pic){ 
   $errorMsg .= ' * Add a Profile Picture<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 (strlen($username) < 4) {
           $errorMsg = "<u>ERROR:</u><br />Your User Name is too short. 4 - 20 characters please.<br />"; 
 } else if (strlen($username) > 20) {
           $errorMsg = "<u>ERROR:</u><br />Your User Name is too long. 4 - 20 characters please.<br />"; 
 } else if ($uname_check > 0){ 
          $errorMsg = "<u>ERROR:</u><br />Your User Name is already in use inside of our system. Please try another.<br />"; 
 } else if ($email_check > 0){ 
          $errorMsg = "<u>ERROR:</u><br />Your Email address is already in use inside of our system. Please use another.<br />"; 
 } else if ($_FILES['fileField']['tmp_name'] != "") { 
        $maxfilesize = 51200; // 51200 bytes equals 50kb
        if($_FILES['fileField']['size'] > $maxfilesize ) { 

                    $error_msg = '<font color="#FF0000">ERROR: Your image was too large, please try again.</font>';
                    unlink($_FILES['fileField']['tmp_name']); 

        } else if (!preg_match("/\.(gif|jpg|png)$/i", $_FILES['fileField']['name'] ) ) {

                    $error_msg = '<font color="#FF0000">ERROR: Your image was not one of the accepted formats, please try again.</font>';
                    unlink($_FILES['fileField']['tmp_name']); 
        } else { 
                    $newname = "image01.jpg";
                    $place_file = move_uploaded_file( $_FILES['fileField']['tmp_name'], "members/$id/".$newname);
        }

} {

 $email1 = mysql_real_escape_string($email1);
 $pass1 = mysql_real_escape_string($pass1);
 $db_password = md5($pass1); 
 $full_birthday = "$b_y-$b_m-$b_d";
 $ipaddress = getenv('REMOTE_ADDR');

 $sql = mysql_query("INSERT INTO myMembers (username, gender, birthday, email, password, ipaddress, sign_up_date) 
 VALUES('$username','$gender','$full_birthday','$email1','$db_password', '$ipaddress', now())")  
 or die (mysql_error());
 $id = mysql_insert_id();
 mkdir("members/$id", 0755);
 }

 } else { // if the form is not posted with variables, place default empty variables so no warnings or errors show

  $errorMsg = "";
  $username = "";
  $gender = "";
  $b_m = "";
  $b_d = "";
  $b_y = "";
  $email1 = "";
  $email2 = "";
  $pass1 = "";
  $pass2 = "";
  $user_pic = "";
}

And then the corresponding html form:

<table class="table_f" width="100%" cellpadding="3">
<form action="register.php" method="post" enctype="multipart/form-data">

      <tr>
        <td colspan="2"><font color="#94A0D1"><?php print "$errorMsg"; ?></font></td>
      </tr>       
      <tr>
        <td><h11>Add Profile Picture: </h11></td>         
          <td width="61"><?php echo $user_pic; ?></td>
          <td width="521"><input name="fileField" type="file" class="formFields" id="fileField" size="42" />
          50 kb max </td>
      </tr> 
      <tr>
        <td><input type="submit" style="color: #a2a2a2; font-family: helvetica; font-size: 11px; letter-spacing: 1px" name="Submit" value="Register" />
        </td>
      </tr>
    </form>
  </table>

If anyone has any ideas about what I might be missing I would really appreciate it. I have been staring at this for so long that I am probably missing something obvious.

Thanks in advance for any advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:30:45+00:00Added an answer on May 24, 2026 at 9:30 pm

    It doesn’t look as if you have an input called user_pic which is what you are looking to get as a POST variable. You have named your file picker as fileField, which should be user_pic according to the rest of your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the situation that I'm facing: I have two tables A and B.
I have Apache running on a public-facing Debian server, and am a bit worried
I have a public facing website that has been receiving a number of SQL
I am facing a situation that I have problem understanding... I am writing a
Im facing a bit of an issue when trying to validate a decimal property
I have a bit of a problem. I'm trying to add,remove and edit items
I would like to have a MovieClip that has a bit of depth. I
I'm trying to learn a bit of ASP.net MVC 3 and I'm facing a
I'm facing the following problem : I have to merge two images A and
I'm facing a bit of difficulties implementing the HA for my ActiveMQ service. Right

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.