Click here to Skip to main content
14,928,868 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
signup.php
<?php

session_start();




  if($_POST['name']=="" OR $_POST['name']==""  OR $_POST['number']==""  OR $_POST['nrc']=="" OR $_POST['email']=="" OR $_FILES['upload']['size'] == 0  OR $_POST['password']=="")  {
	  
      $password= md5('$password');
	  
	   $json = json_encode(array(
	   
            'status' => 'notsuccessfull',
            'responseResult' => 'datanotposted'
        ));
	    echo $json;
	    exit;
	  
  
  
  } else {
	    
	 
	 
	 $upload_file = $_FILES['upload'];  
	
	
	//profile
	
	$upload_file_name = $upload_file['name'];
	$upload_file_temp = $upload_file['tmp_name'];
	$upload_file_size = $upload_file['size'];
	$upload_file_error= $upload_file['error'];
 
    // Directory destinations
	
	 $upload_file_destination = '../images/'.$upload_file_name;
	 
	  // Posting to the upload directory
	 
	 if(move_uploaded_file($upload_file_temp ,$upload_file_destination))
		 
	 {
	
          $first=filter_input(INPUT_POST, "name");
		  $last=filter_input(INPUT_POST, "name");
		  $phone=filter_input(INPUT_POST, "number");
		  $identy=filter_input(INPUT_POST, "nrc");
		  $em=filter_input(INPUT_POST, "email");
		  $psw=filter_input(INPUT_POST, "password");
		  
		  $finaluploaddestinate  = '../image/'.$upload_file_name;
		  
		  require_once '../conf/loan.php';

          $conn = new PDO("mysql:host=localhost;dbname=auction", 'root', "");
		
		
		  $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
		  
		  $insertquery = "INSERT INTO signup(first,last,phone,identy,email,pic,pass) VALUES (:f,:l,:p,:i,:e,:pic,:pa)";
		 
		  $insertcustomerinformation = $conn->prepare($insertquery);
			
	      $insertcustomerinformation->bindParam(':f',$first);
		  $insertcustomerinformation->bindParam(':l',$last);
		  $insertcustomerinformation->bindParam(':p',$phone);
		  $insertcustomerinformation->bindParam(':i',$identy);
		  $insertcustomerinformation->bindParam(':e',$em);
		  $insertcustomerinformation->bindParam(':pic',$finaluploaddestinate);
		  $insertcustomerinformation->bindParam(':pa',$psw);
		 
		  $insertcustomerinformation->execute();
							
		  $customerid=$conn->lastInsertId();
		  
		  // End of checking if the business information has been posted to the database
		  
		  if($customerid > 0){
							
				 
				  $json = json_encode(array(
                    'status' => 'successfull',
                    'responseResult' => 'uploadsuccessful'
                  ));

                  echo $json;
							  
				  exit;
							  
							  
							  
			}  else {
							
				  unlink($upload_file_destination);
				 
				  $json = json_encode(array(
	   
                    'status' => 'notsuccessfull',
                    'responseResult' => 'uploadnotsuccessful'
				 
                  ));
		
	             echo $json;
				  
				 exit;
				 
				 
		   }  // End of checking if the business information has been posted to the database
	
			
			 
	 }  else {
		
		// If the posting to the upload has failed do the following
		
		
	}
 
     // End of posting to the upload directory
  
	  
	  
  }
  
  // checking if the image and song file are available
  
	

?>


What I have tried:

have tried different methods but have failed and have never done it before,anyone with help.
Posted
Updated 20-Feb-21 1:55am
Comments
Patrice T 20-Feb-21 7:29am
   
Define Email validation.

   
Not your question, but :
PHP
if($_POST['name']=="" OR $_POST['name']==""  OR $_POST['number']==""  OR $_POST['nrc']=="" OR $_POST['email']=="" OR $_FILES['upload']['size'] == 0  OR $_POST['password']=="")  {

You check 2 times the same thing.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900