Advertisement
Guest User

Untitled

a guest
Oct 18th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. if($_GET['action'] == "createAdmin") {
  2.  
  3. $email = filter_input(INPUT_POST, 'email');
  4. $username = filter_input(INPUT_POST, 'username');
  5. $password = filter_input(INPUT_POST, 'password');
  6. $confirm = filter_input(INPUT_POST, 'confirm_password');
  7.  
  8. $current_date = date("Y-m-d h:i:s a");
  9. $microTime = microtime();
  10.  
  11.  
  12. if($password == $confirm) {
  13.  
  14. $hash_pass = crypt($password .$microTime);
  15.  
  16. $pass_crypt = crypt($password); // let the salt be automatically generated
  17.  
  18. $statement_insertAdmin = $conn->prepare("INSERT INTO admin_login(username, password, email, created_date, hash)
  19. VALUES(:user, :pass, :email, :created, :hash)");
  20. $statement_insertAdmin->execute(array(
  21. "user" => $username,
  22. "pass" => $pass_crypt,
  23. "email" => $email,
  24. "created" => $current_date,
  25. "hash" => $hash_pass
  26. ));
  27.  
  28. //send verification email with hash
  29. $to = $email;
  30. $subject = "Admin Account Created";
  31.  
  32. $htmlbody = 'Please click the link below to activate your admin account! <br><Br>
  33.  
  34. <a href='http://www.companyname.com/admin/activate.php? a=1&h='.$hash.''>
  35. Activate Now </a>
  36. ';
  37.  
  38.  
  39. $headers = "MIME-Version: 1.0" . "rn";
  40. $headers .= "Content-type:text/html;charset=UTF-8" . "rn";
  41.  
  42. // More headers
  43. $headers .= 'From: Company Name<email@email.com>';
  44.  
  45. mail($to,$subject,$htmlbody,$headers);
  46.  
  47. echo "created";
  48.  
  49. }
  50.  
  51. else {
  52. echo 'false confirm';
  53. }
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement