Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. date_default_timezone_set('Europe/London');
  2. $dtime = date('d/m/Y H:i');
  3.  
  4. $user = 'root';
  5. $password = '';
  6. $db = new PDO('mysql:host=localhost;dbname=login', $user, $password );
  7.  
  8.  
  9. if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  10. $form = $_POST;
  11. $fname = $form['fname'];
  12. $sname = $form['sname'];
  13. $dob = $form['dob'];
  14. $email = $form['email'];
  15. $role = $form['role'];
  16. $location = $form['location'];
  17. $why = $form['why'];
  18. $rpexp = $form['rpexp'];
  19. $pastrp = $form['pastrp'];
  20. $tandc = $form['tandc'];
  21. $status = '0';
  22.  
  23. //make sure user has accepted terms and conditions
  24. if ($tandc == '1') {
  25. //make sure email is valid
  26. if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
  27. //prepare statements
  28. $stmt = $db->prepare("INSERT INTO applications (`fname`, `sname`, `dob`, `email`, `role`, `location`, `why`, `rpexp`, `pastrp`, `status`, `dofsubmission`)
  29. VALUES (:fname, :sname, :dob, :email, :role, :location, :why, :rpexp, :pastrp, :status, :dtime)");
  30.  
  31. //insert blind paramaters
  32. $stmt->bindParam(':fname', $fname, $db::PARAM_STR);
  33. $stmt->bindParam(':sname', $sname, $db::PARAM_STR);
  34. $stmt->bindParam(':dob', $dob, $db::PARAM_STR);
  35. $stmt->bindParam(':email', $email, $db::PARAM_STR);
  36. $stmt->bindParam(':role', $role, $db::PARAM_STR);
  37. $stmt->bindParam(':location', $location, $db::PARAM_STR);
  38. $stmt->bindParam(':why', $why, $db::PARAM_STR);
  39. $stmt->bindParam(':rpexp', $rpexp, $db::PARAM_STR);
  40. $stmt->bindParam(':pastrp', $pastrp, $db::PARAM_STR);
  41. $stmt->bindParam(':status', $status, $db::PARAM_STR);
  42. $stmt->bindParam(':dtime', $dtime, $db::PARAM_STR);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement