PageRenderTime 25ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/README

https://bitbucket.org/neoben/ecommerce
#! | 157 lines | 125 code | 32 blank | 0 comment | 0 complexity | a89dc373986372b0c82343b94620175c MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. Overview:
  2. ========
  3. Simple E-Commerce System: a web interface that implements a simple and secure e-commerce system using PHP and MySQL.
  4. Author:
  5. ======
  6. Carmine Benedetto
  7. Website: http://www.carminebenedetto.net
  8. Email: carmine.benedetto[at]gmail.com
  9. Used Tools:
  10. ==========
  11. - Apache/2.2.22 (Ubuntu)
  12. - MySQL client version: 5.5.24
  13. - PHP extension: mysqli
  14. - phpMyAdmin version: 3.4.10.1deb1
  15. Application Structure:
  16. =====================
  17. index.php
  18. ---------
  19. First page of the application. This page shows the store window with products, price and store availability.
  20. The user can Log In if he's already registered or Sign Up if he's not.
  21. Doing the Log In, the user will be redirected to the Store page.
  22. If a User Session is open, all the requests for the Index page will be redirected to the Store page.
  23. Dependencies:
  24. index.php -> Log In -> store.php
  25. index.php -> Sign Up -> register.html
  26. register.html
  27. -------------
  28. User Registration From.
  29. Dependencies:
  30. register.html -> Register -> registration.php
  31. registration.php
  32. ----------------
  33. This module gets the user paramters from the Registration Form, performs the appropriate checks and writes the user data in the database (user table).
  34. Dependencies:
  35. registration.php -> index.php
  36. store.php
  37. ---------
  38. In this page the user can choose the products he wants to buy. A lateral bar indicates the log status and the cart status.
  39. Dependencies:
  40. store.php -> Add Items to the Cart -> addcart.php
  41. store.php -> Show the Cart -> showcart.php
  42. addcart.php
  43. -----------
  44. This module gets the cart parameters from the Add To Cart Form, performs the appropriate checks and write the cart data in the database (cart table).
  45. At the end of all the operation, the module redirects the user to the Store page.
  46. Dependencies:
  47. addcart.php -> store.php
  48. showcart.php
  49. -----------
  50. This page shows the Cart with products, quantity and total amount of chosen products.
  51. The user can pay for the chosen products (putting the credit card parameters), empty the cart or go back to the store.
  52. Dependencies:
  53. showcart.php -> Checkout -> pay.php
  54. showcart.php -> Empty Cart -> emptycart.php
  55. showcart.php -> store.php
  56. emptycart.php
  57. -------------
  58. This module deletes from the database the data from the cart table for the currently logged on user.
  59. At the end of all the operations, the module redirects the user to the Store page.
  60. Dependencies:
  61. emptycart.php -> store.php
  62. pay.php
  63. -------
  64. This module gets the credit card parameters from the Payment Form, checks if the chosen products are still available on the store and than simulates a payment transation.
  65. The payment transation is performed using a random function.
  66. In case of successful transation, the module empties the cart.
  67. Dependencies:
  68. pay.php -> store.php
  69. LOGOUT
  70. ------
  71. It's possible do the Log Out from different pages using the lateral bar.
  72. The Log Out operation redirects the user to the Index page.
  73. Pages:
  74. store.php
  75. showcart.pgp
  76. pay.php
  77. Database Tables:
  78. ===============
  79. - products -
  80. ------------------------------
  81. | id | item | prize | number |
  82. ------------------------------
  83. - id: product id;
  84. - item: product name;
  85. - prize: product price;
  86. - number: product availability.
  87. - users -
  88. --------------------------------------------------------------------
  89. | name | surname | country | address | email | username | password |
  90. --------------------------------------------------------------------
  91. - cart -
  92. ----------------------------
  93. | sid | id_item | quantity |
  94. ----------------------------
  95. - sid: $_SESSION['username'] (super global variable);
  96. - id_item : product id;
  97. - quantity: item quantity to buy.
  98. - sessions -
  99. -------------------------
  100. | sid | sdata | sexpire |
  101. -------------------------
  102. - sid: session id;
  103. - sdata: session data corresponding with $_SESSION['username'];
  104. - sexpire: session expiration time.
  105. NOTE ABOUT THE CART AND THE SESSION MANAGEMENT:
  106. ==============================================
  107. Adding items to the cart the database table product is not modified so the product availability remains unchanged until the successful payment.
  108. In the Session Garbage Collector, a cart connected to a session is deleted if the session expires or if it is destroyed.
  109. ATOMIC OPERATIONS / LOCKS:
  110. =========================
  111. New User Registration
  112. File: registration.php
  113. Locked tables: users(WRITE)
  114. Add items to the cart
  115. File: addcart.php
  116. Locked tables: cart(WRITE)
  117. Empty the cart
  118. File: addcart.php
  119. Locked tables: cart(WRITE)
  120. Payment
  121. File: pay.php
  122. Locked tables: products(WRITE), cart(WRITE)
  123. Session Garbage Collector
  124. File: class_session.php
  125. Locked tables: cart(WRITE), sessions(WRITE)