Guest User

Untitled

a guest
Feb 22nd, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. <?php
  2. if(count($_FILES) > 0 && isset($_POST['terms'])) {
  3. if(is_uploaded_file($_FILES['image']['tmp_name'])) {
  4.  
  5. include '././php_add_ons/stuff/connect.php';
  6. $password1 = $_POST['password1'];
  7. $password2 = $_POST['password2'];
  8.  
  9. $imgData = addslashes(file_get_contents($_FILES['image']['tmp_name']));
  10. $imageProperties = getimagesize($_FILES['image']['tmp_name']);
  11.  
  12. if($password1 == $password2)
  13. {
  14. $user = $_POST['userName'];
  15. $userImage = $_POST['userName'];
  16. $password = $_POST['password1'];
  17. $email = $_POST['email'];
  18. if(isset($user) && !empty($user) && isset($email) && !empty($email)){
  19. if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){
  20. // Return Error - Invalid Email
  21. $msg = 'The email you have entered is invalid, please try again.';
  22. }
  23. else{
  24. $check = mysqli_query($con, "SELECT * FROM user");
  25. $checkUser = mysqli_fetch_assoc($check);
  26.  
  27. if($user == $checkUser['User_Name'] || $email == $checkUser['User_Email']){
  28. echo "The user name or email is already registered.";
  29. }
  30. else{
  31. $sql = "INSERT INTO user(User_Name,Image_Name, User_Password, User_Email, Image_Type, User_Image) VALUES ('$user', '$userImage', md5('$password'), '$email', '{$imageProperties['mime']}', '{$imgData}')";
  32. $current_id = mysqli_query($con, $sql) or die("<b>Error:</b> Problem on Insert information<br/>" . mysqli_error($con));
  33.  
  34. $sqlLogin = mysqli_query($con, "SELECT * FROM user WHERE User_Name = '$user' AND User_Password = md5('$password')");
  35. $count = mysqli_num_rows($sqlLogin);
  36. if($count == 1)
  37. {
  38. $row = mysqli_fetch_assoc($sqlLogin);
  39.  
  40. setcookie("user", $row["User_Name"]);
  41. header ("Location: ././After_Login/index.php");
  42. }
  43. }
  44. }
  45. }
  46. }
  47. else {
  48. Echo "Your passwords did not match.";
  49. }
  50. }
  51. }else {
  52. echo "You must accept the terms.";
  53. }
  54. ?>
Add Comment
Please, Sign In to add comment