59 |
60 |

Hello,

61 |
62 | 63 |
64 |
-------------------------------------------------------------------------------- /admin/classes/Credentials.php: -------------------------------------------------------------------------------- 1 | con = $db->connect(); 16 | } 17 | 18 | 19 | public function createAdminAccount($name, $email, $password){ 20 | $q = $this->con->query("SELECT email FROM admin WHERE email = '$email'"); 21 | if ($q->num_rows > 0) { 22 | return ['status'=> 303, 'message'=> 'Email already exists']; 23 | }else{ 24 | $password = password_hash($password, PASSWORD_BCRYPT, ["COST"=> 8]); 25 | $q = $this->con->query("INSERT INTO `admin`(`name`, `email`, `password`, `is_active`) VALUES ('$name','$email','$password','0')"); 26 | if ($q) { 27 | return ['status'=> 202, 'message'=> 'Admin Created Successfully']; 28 | } 29 | 30 | } 31 | } 32 | 33 | public function loginAdmin($email, $password){ 34 | $q = $this->con->query("SELECT * FROM admin WHERE email = '$email' LIMIT 1"); 35 | if ($q->num_rows > 0) { 36 | $row = $q->fetch_assoc(); 37 | if (password_verify($password, $row['password'])) { 38 | $_SESSION['admin_name'] = $row['name']; 39 | $_SESSION['admin_id'] = $row['id']; 40 | return ['status'=> 202, 'message'=> 'Login Successful']; 41 | }else{ 42 | return ['status'=> 303, 'message'=> 'Login Fail']; 43 | } 44 | }else{ 45 | return ['status'=> 303, 'message'=> 'Account not created yet with this email']; 46 | } 47 | } 48 | 49 | } 50 | 51 | //$c = new Credentials(); 52 | //$c->createAdminAccount("Rizwan", "rizwan@gmail.com", "12345"); 53 | 54 | //PRINT_R($c->loginAdmin("rizwan@gmail.com", "12345")); 55 | 56 | if (isset($_POST['admin_register'])) { 57 | extract($_POST); 58 | if (!empty($name) && !empty($email) && !empty($password) && !empty($cpassword)) { 59 | if ($password == $cpassword) { 60 | $c = new Credentials(); 61 | $result = $c->createAdminAccount($name, $email, $password); 62 | echo json_encode($result); 63 | exit(); 64 | }else{ 65 | echo json_encode(['status'=> 303, 'message'=> 'Password mismatch']); 66 | exit(); 67 | } 68 | }else{ 69 | echo json_encode(['status'=> 303, 'message'=> 'Empty fields']); 70 | exit(); 71 | } 72 | } 73 | 74 | if (isset($_POST['admin_login'])) { 75 | extract($_POST); 76 | if (!empty($email) && !empty($password)) { 77 | $c = new Credentials(); 78 | $result = $c->loginAdmin($email, $password); 79 | echo json_encode($result); 80 | exit(); 81 | }else{ 82 | echo json_encode(['status'=> 303, 'message'=> 'Empty fields']); 83 | exit(); 84 | } 85 | } 86 | 87 | 88 | ?> -------------------------------------------------------------------------------- /login.php: -------------------------------------------------------------------------------- 1 | Please register before login..!"; 52 | exit(); 53 | } 54 | 55 | } 56 | 57 | ?> -------------------------------------------------------------------------------- /admin/js/brands.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | 3 | getBrands(); 4 | 5 | function getBrands(){ 6 | $.ajax({ 7 | url : '../admin/classes/Products.php', 8 | method : 'POST', 9 | data : {GET_BRAND:1}, 10 | success : function(response){ 11 | console.log(response); 12 | var resp = $.parseJSON(response); 13 | 14 | var brandHTML = ''; 15 | 16 | $.each(resp.message, function(index, value){ 17 | brandHTML += ''+ 18 | ''+ 19 | ''+ value.brand_title +''+ 20 | ''+JSON.stringify(value)+' '+ 21 | ''; 22 | }); 23 | 24 | $("#brand_list").html(brandHTML); 25 | 26 | } 27 | }) 28 | 29 | } 30 | 31 | $(".add-brand").on("click", function(){ 32 | 33 | $.ajax({ 34 | url : '../admin/classes/Products.php', 35 | method : 'POST', 36 | data : $("#add-brand-form").serialize(), 37 | success : function(response){ 38 | var resp = $.parseJSON(response); 39 | if (resp.status == 202) { 40 | getBrands(); 41 | $("#add_brand_modal").modal('hide'); 42 | alert(resp.message); 43 | }else if(resp.status == 303){ 44 | alert(resp.message); 45 | } 46 | 47 | } 48 | }) 49 | 50 | }); 51 | 52 | $(document.body).on('click', '.delete-brand', function(){ 53 | 54 | var bid = $(this).attr('bid'); 55 | 56 | if (confirm("Are you sure to delete this brand")) { 57 | $.ajax({ 58 | url : '../admin/classes/Products.php', 59 | method : 'POST', 60 | data : {DELETE_BRAND:1, bid:bid}, 61 | success : function(response){ 62 | var resp = $.parseJSON(response); 63 | if (resp.status == 202) { 64 | alert(resp.message); 65 | getBrands(); 66 | }else if(resp.status == 303){ 67 | alert(resp.message); 68 | } 69 | } 70 | }); 71 | }else{ 72 | alert('Cancelled'); 73 | } 74 | 75 | 76 | 77 | }); 78 | 79 | $(document.body).on("click", ".edit-brand", function(){ 80 | 81 | var brand = $.parseJSON($.trim($(this).children("span").html())); 82 | console.log(brand); 83 | $("input[name='e_brand_title']").val(brand.brand_title); 84 | $("input[name='brand_id']").val(brand.brand_id); 85 | 86 | $("#edit_brand_modal").modal('show'); 87 | 88 | 89 | 90 | }); 91 | 92 | $(".edit-brand-btn").on("click", function(){ 93 | $.ajax({ 94 | url : '../admin/classes/Products.php', 95 | method : 'POST', 96 | data : $("#edit-brand-form").serialize(), 97 | success : function(response){ 98 | var resp = $.parseJSON(response); 99 | if (resp.status == 202) { 100 | getBrands(); 101 | $("#edit_brand_modal").modal('hide'); 102 | alert(resp.message); 103 | }else if(resp.status == 303){ 104 | alert(resp.message); 105 | } 106 | 107 | } 108 | }); 109 | }); 110 | 111 | }); -------------------------------------------------------------------------------- /admin/js/categories.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | 3 | getCategories(); 4 | 5 | function getCategories(){ 6 | $.ajax({ 7 | url : '../admin/classes/Products.php', 8 | method : 'POST', 9 | data : {GET_CATEGORIES:1}, 10 | success : function(response){ 11 | console.log(response); 12 | var resp = $.parseJSON(response); 13 | 14 | var brandHTML = ''; 15 | 16 | $.each(resp.message, function(index, value){ 17 | brandHTML += ''+ 18 | ''+ 19 | ''+ value.cat_title +''+ 20 | ''+JSON.stringify(value)+' '+ 21 | ''; 22 | }); 23 | 24 | $("#category_list").html(brandHTML); 25 | 26 | } 27 | }) 28 | 29 | } 30 | 31 | $(".add-category").on("click", function(){ 32 | 33 | $.ajax({ 34 | url : '../admin/classes/Products.php', 35 | method : 'POST', 36 | data : $("#add-category-form").serialize(), 37 | success : function(response){ 38 | var resp = $.parseJSON(response); 39 | if (resp.status == 202) { 40 | getCategories(); 41 | alert(resp.message); 42 | }else if(resp.status == 303){ 43 | alert(resp.message); 44 | } 45 | $("#add_category_modal").modal('hide'); 46 | } 47 | }) 48 | 49 | }); 50 | 51 | $(document.body).on("click", ".edit-category", function(){ 52 | 53 | var cat = $.parseJSON($.trim($(this).children("span").html())); 54 | $("input[name='e_cat_title']").val(cat.cat_title); 55 | $("input[name='cat_id']").val(cat.cat_id); 56 | 57 | $("#edit_category_modal").modal('show'); 58 | 59 | 60 | 61 | }); 62 | 63 | $(".edit-category-btn").on('click', function(){ 64 | 65 | $.ajax({ 66 | url : '../admin/classes/Products.php', 67 | method : 'POST', 68 | data : $("#edit-category-form").serialize(), 69 | success : function(response){ 70 | var resp = $.parseJSON(response); 71 | if (resp.status == 202) { 72 | getCategories(); 73 | alert(resp.message); 74 | }else if(resp.status == 303){ 75 | alert(resp.message); 76 | } 77 | $("#edit_category_modal").modal('hide'); 78 | } 79 | }) 80 | 81 | }); 82 | 83 | $(document.body).on('click', '.delete-category', function(){ 84 | 85 | var cid = $(this).attr('cid'); 86 | 87 | if (confirm("Are you sure to delete this category")) { 88 | $.ajax({ 89 | url : '../admin/classes/Products.php', 90 | method : 'POST', 91 | data : {DELETE_CATEGORY:1, cid:cid}, 92 | success : function(response){ 93 | var resp = $.parseJSON(response); 94 | if (resp.status == 202) { 95 | alert(resp.message); 96 | getCategories(); 97 | }else if(resp.status == 303){ 98 | alert(resp.message); 99 | } 100 | } 101 | }) 102 | }else{ 103 | alert('Cancelled'); 104 | } 105 | 106 | 107 | 108 | }); 109 | 110 | }); -------------------------------------------------------------------------------- /login_form.php: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | Ecommerce 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
32 |
33 | 44 |


45 |


46 |


47 |
48 |
49 |
50 |
51 | 52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
Customer Login Form
60 |
61 | 62 |
63 | 64 | 65 | 66 | 67 |


68 | Forgotten Password 69 | 70 | 71 |
72 |
73 | 74 |
75 |
76 |
77 |
78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /payment_success.php: -------------------------------------------------------------------------------- 1 | 0) { 25 | # code... 26 | while ($row=mysqli_fetch_array($query)) { 27 | $product_id[] = $row["p_id"]; 28 | $qty[] = $row["qty"]; 29 | } 30 | 31 | for ($i=0; $i < count($product_id); $i++) { 32 | $sql = "INSERT INTO orders (user_id,product_id,qty,trx_id,p_status) VALUES ('$cm_user_id','".$product_id[$i]."','".$qty[$i]."','$trx_id','$p_st')"; 33 | mysqli_query($con,$sql); 34 | } 35 | 36 | $sql = "DELETE FROM cart WHERE user_id = '$cm_user_id'"; 37 | if (mysqli_query($con,$sql)) { 38 | ?> 39 | 40 | 41 | 42 | 43 | Ecommerce 44 | 45 | 46 | 47 | 48 | 51 | 52 | 53 | 64 |


65 |


66 |


67 |
68 | 69 |
70 |
71 |
72 |
73 |
74 |
75 |

Thankyou

76 |
77 |

Hello ".$_SESSION["name"].""; ?>,Your payment process is 78 | successfully completed and your Transaction id is
79 | you can continue your Shopping

80 | Continue Shopping 81 |
82 | 83 |
84 |
85 |
86 |
87 |
88 | 89 | 90 | 91 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /cart.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | Ecommerce 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |
21 | 40 |


41 |


42 |


43 |
44 |
45 |
46 |
47 | 48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
Cart Checkout
56 |
57 |
58 |
Action
59 |
Product Image
60 |
Product Name
61 |
Quantity
62 |
Product Price
63 |
Price in
64 |
65 |
66 | 79 | 84 |
85 |
86 | 87 |
88 |
89 |
90 | 91 |
92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /admin/brands.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |
6 | 7 | 8 | 9 | 10 |
11 |
12 |

Manage Brand

13 |
14 |
15 | Add Brand 16 |
17 |
18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 38 | 39 |
#NameAction
40 |
41 |