Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. <?php
  2. require('../model/database.php');
  3. require('../model/registration_db.php');
  4.  
  5. if (isset($_POST['action']))
  6. {
  7. $action = $_POST['action'];
  8. }
  9. else if (isset($_GET['action']))
  10. {
  11. $action = $_GET['action'];
  12. }
  13. else
  14. {
  15. $action = 'product_login';
  16. }
  17.  
  18.  
  19. echo $action;
  20.  
  21.  
  22. if ($action == 'product_login')
  23. {
  24. include('product_login.php');
  25. }
  26.  
  27.  
  28. if ($action == 'get_customer_registrations')
  29. {
  30. if (!isset($email))
  31. {
  32. $email = filter_input(INPUT_POST, 'email');
  33. }
  34. if (empty($email))
  35. {
  36. //Page displayed when search field is left blank upon clicking submit.
  37. $error = "Please enter an email address into the search field.";
  38. include('../view/header.php');
  39. include('../errors/error_no_header_footer.php');
  40. include('../errors/error_customer_login.php');
  41. include ('../view/footer.php');
  42. }
  43. else
  44. {
  45. //Code to display customer first & last name based upon submitted email address.
  46. $customers = search_customer_email($email); //DISPLAYS FIRST & LAST NAME
  47.  
  48. //VARIABLES FOR THIS ACTION
  49. $email = filter_input(INPUT_POST, 'email');
  50. $productCode = filter_input(INPUT_POST, 'productCode');
  51. $cust_ID = filter_input(INPUT_POST, 'customerID');
  52.  
  53. $numOfProducts = get_products();
  54. $customer = get_customer($cust_ID);
  55.  
  56. $exists = check_registration($cust_ID, $productCode);
  57. $numProductRows = $numOfProducts->rowCount();
  58.  
  59. //Code to return row count of products registered to the customerID.
  60. $numCustomerRegistrations = count_all_registrations($cust_ID); //< --- GIVES ROWCOUNT
  61.  
  62. //Code to obtain products that are already registered to the email address.
  63. $registrations = get_products_by_customer($email); //DISPLAYS LIST OF ALREADY REGISTERED PRODUCTS
  64.  
  65. //Display pre registered products in a neat little table!
  66. include('product_register.php');
  67. }
  68. }
  69.  
  70. if ($action == 'register_product')
  71. {
  72. echo $product['productCode'];
  73. echo $product['name'];
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement