SHARE
TWEET

Avon

sunnexy Jun 15th, 2017 22 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.  
  4. $mypic = $_FILES['upload']['name']; //name of the upload button and name of the file
  5. $temp = $_FILES['upload']['tmp_name']; //temp name of the file
  6. $type = $_FILES['upload']['type']; //HOLDS the type of file
  7. //$filepath = $imageDir . $mypic;
  8.  
  9. $name = $_POST['name'];
  10. $email = $_POST['email'];
  11. $password = $_POST['password'];
  12. $cpassword = $_POST['cpassword'];
  13. $link= mysqli_connect("localhost","root", "sunpas") or die("Try Again Later");
  14.  
  15. if($name && $email && $password && $cpassword){
  16.     if(filter_var($email, FILTER_VALIDATE_EMAIL)){
  17.  
  18.         if(strlen($password)>5){
  19.  
  20.             if($password==$cpassword){
  21.  
  22.                 $link= mysqli_connect("localhost","root", "sunpas") or die("Try Again Later");
  23.  
  24.                 mysqli_select_db($link,"testsite");
  25.                 $username= mysqli_query($link, "SELECT Name FROM users WHERE Name='$name'");
  26.                 $count = mysqli_num_rows($username);
  27.                 $useremail= mysqli_query($link, "SELECT Email FROM users WHERE Email='$email'");
  28.                 $checkemail = mysqli_num_rows($useremail);
  29.                 if($count!=0){
  30.                     include('links.php');
  31.                     echo "Name already exists! Please type another name";
  32.                     }
  33.            
  34.                     if($checkemail!=0){
  35.                         include('links.php');
  36.                         echo "ERROR: Email already exists! Please type another email";
  37.                     }
  38.                
  39.                     else
  40.                     {
  41.                         //mysqli_query($link, "INSERT INTO users(Name,Email,Password) VALUES('$name', '$email','$password')");
  42.  
  43.                         if(($type=="image/jpeg") || ($type=="image/jpg") || ($type=="image/bmp")){
  44.                             move_uploaded_file($temp, "images/$mypic");
  45.                             echo "Funny Face!<p><img border='1' width='70' height='70' src='images/$mypic'><p>";
  46.    
  47.                             $passwordmd5 = md5($password);
  48.                             $rval = mysqli_query($link, "INSERT INTO users(Name,Email,Password) VALUES('$name', '$email','$passwordmd5')");
  49.                             if (!$rval){
  50.                                 die('could not enter data '. mysqli_error($link));
  51.                         }
  52.                         else{
  53.                             echo "Entered data successfully! <a href='home.php'>Login now!</a>";
  54.                         }
  55.                         }
  56.                         else{
  57.                         echo "This file has to be a jpeg, jpg or bmp!";
  58.                         }
  59.                     }
  60.                 }
  61.                 else{
  62.                 echo "Password does not match!";
  63.             }
  64.         }
  65.         else{
  66.             echo "password is too short! must be atleast 6 characters";
  67.         }
  68.     }
  69.     else{
  70.         echo "please type a valid email!";
  71.     }
  72. }
  73. else{
  74.     echo "You have to complete the form";
  75. }
  76. mysqli_close($link);
  77. include('links.php');
  78. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top