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