Guest User

Untitled

a guest
Dec 13th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. <?php
  2. /**
  3. * Check if a user can start the winter mooring buying process and setup session
  4. *
  5. * Long desc
  6. *
  7. * @package BwMoorings
  8. * @subpackage WinterMoorings
  9. * @author Paul Morgan <[email protected]>
  10. * @version $Id: tags.version.pkg
  11. */
  12. /**
  13. *
  14. */
  15. session_start();
  16. include_once(ETC_DIR . 'preload_options.php');
  17. CheckAccess($_SESSION['bwm_user_reg'], 1);
  18.  
  19.  
  20. if (isset($_SESSION['wintermooring'])) {
  21. unset($_SESSION['wintermooring']);
  22. }
  23. $_SESSION['winter_mooring'] = array();
  24.  
  25. if (filter_has_var(INPUT_GET, "id")) {
  26. $mlid = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
  27. //check id is in the form expected and exists in the database.
  28. if (filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT)) {
  29. $_SESSION['wintermooring']['id'] = $mlid;
  30. }
  31. } else {
  32. // set error and then log the problem?
  33. $_SESSION['errors'] = array('bad_id','The mooring location cannot be found on our database. Please search again.');
  34. header("Location: " . BWSITEURL . "winter-mooring/error.php");
  35. exit;
  36. }
  37.  
  38. if (filter_has_var(INPUT_GET, "type")) {
  39. $mltype = filter_input(INPUT_GET, 'type', FILTER_SANITIZE_STRING);
  40. if (in_array($mltype, array('mooring') )) {
  41. $_SESSION['wintermooring']['type'] = $mltype;
  42. }
  43. } else {
  44. // set error and then log the problem?
  45. $_SESSION['errors'] = array('bad_id','The mooring location cannot be found on our database. Please search again.');
  46. header("Location: " . BWSITEURL . "winter-mooring/error.php");
  47. exit;
  48. }
  49.  
  50. //Move the customer to the first part of the process
  51. header('Location: ' . BWSITEURL . 'winter-mooring/stage1.php');
  52. exit;
Add Comment
Please, Sign In to add comment