Advertisement
Guest User

Untitled

a guest
Apr 15th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['create_user'])) {
  3. /*
  4. * Retrieve all the form values using the $_POST superglobal.
  5. */
  6. if($_POST['password']){
  7. die("passwords too short!");
  8. }
  9. if($_POST['password']){
  10. die("The password requires one uppercase letter a lower case letter and one number!");
  11. }
  12. if($_POST['password'] != $_POST['passwordagain']){
  13. die("passwords do not match");
  14. }
  15. $user_firstname = test_form_input($_POST['user_firstname']);
  16. $user_lastname = test_form_input($_POST['user_lastname']);
  17. $user_role = test_form_input($_POST['user_role']);
  18. $user_email = test_form_input($_POST['user_email']);
  19. $username = test_form_input($_POST['username']);
  20. $password = test_form_input($_POST['password']);
  21.  
  22. $user_image = $_FILES['user_image']['name'];
  23. $user_image_temp = $_FILES['user_image']['tmp_name'];
  24. $user_image_filesize = $_FILES['user_image']['size'];
  25.  
  26. if($user_image != "") {
  27. /*
  28. * This section of the code manages image uploads. As discussed in class,
  29. * we check if the file is of a specified type, and within the allowed file-size.
  30. */
  31. $target_file = "../images/" . $user_image;
  32. $finfo = finfo_open(FILEINFO_MIME_TYPE);
  33. $mime = finfo_file($finfo, $user_image_temp);
  34.  
  35. /*
  36. * A list of MIME types are available here:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement