├── assets
├── img
│ ├── acc.jpg
│ ├── home.jpg
│ ├── logo.png
│ ├── one.avif
│ ├── pc.jpg
│ ├── back.avif
│ ├── ByteBeat.png
│ ├── brandon.png
│ ├── brandtwo.png
│ ├── laptop1.jpeg
│ ├── laptop2.jpeg
│ ├── laptop3.jpeg
│ ├── laptop4.jpeg
│ ├── pv dxvd1.jpeg
│ ├── pv dxvd2.jpeg
│ ├── pv dxvd3.jpeg
│ ├── pv dxvd4.jpeg
│ ├── Home_Image2.jpg
│ ├── Home_Image3.jpg
│ ├── brandfour.jpeg
│ ├── brandthree.png
│ ├── Brands
│ │ ├── Brands-02.png
│ │ ├── Brands-03.png
│ │ ├── Brands-04.png
│ │ ├── Brands-05.png
│ │ └── Brands-06.png
│ └── ByteBeat-01.svg
└── css
│ └── style.css
├── server
├── get_featured_product.php
├── get_pc.php
├── get_acceseioes.php
├── logout.php
├── connection.php
├── changePassword.php
├── complete_payment.php
├── login.php
├── place_order.php
├── register.php
├── fogot_password.php
└── reset_password.php
├── admin
├── server
│ ├── logout.php
│ ├── login.php
│ ├── update_image.php
│ └── create_product.php
├── register.php
├── delete_user.php
├── delete_order.php
├── delete_product.php
├── help.php
├── account.php
├── login.php
├── edit_image.php
├── header.php
├── edit_user.php
├── footer.php
├── users.php
├── add_Product.php
├── edit_order.php
├── dashboard.php
├── edit_product.php
└── product.php
├── contact.php
├── about.php
├── fogot_password.php
├── checkout.php
├── reset_password.php
├── login.php
├── register.php
├── README.md
├── order_details.php
├── layouts
├── footer.php
└── header.php
├── payment.php
├── account.php
├── single_product.php
├── cart.php
├── index.php
├── shop.php
└── tables.sql
/assets/img/acc.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/acc.jpg
--------------------------------------------------------------------------------
/assets/img/home.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/home.jpg
--------------------------------------------------------------------------------
/assets/img/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/logo.png
--------------------------------------------------------------------------------
/assets/img/one.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/one.avif
--------------------------------------------------------------------------------
/assets/img/pc.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/pc.jpg
--------------------------------------------------------------------------------
/assets/img/back.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/back.avif
--------------------------------------------------------------------------------
/assets/img/ByteBeat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/ByteBeat.png
--------------------------------------------------------------------------------
/assets/img/brandon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/brandon.png
--------------------------------------------------------------------------------
/assets/img/brandtwo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/brandtwo.png
--------------------------------------------------------------------------------
/assets/img/laptop1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/laptop1.jpeg
--------------------------------------------------------------------------------
/assets/img/laptop2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/laptop2.jpeg
--------------------------------------------------------------------------------
/assets/img/laptop3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/laptop3.jpeg
--------------------------------------------------------------------------------
/assets/img/laptop4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/laptop4.jpeg
--------------------------------------------------------------------------------
/assets/img/pv dxvd1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/pv dxvd1.jpeg
--------------------------------------------------------------------------------
/assets/img/pv dxvd2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/pv dxvd2.jpeg
--------------------------------------------------------------------------------
/assets/img/pv dxvd3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/pv dxvd3.jpeg
--------------------------------------------------------------------------------
/assets/img/pv dxvd4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/pv dxvd4.jpeg
--------------------------------------------------------------------------------
/assets/img/Home_Image2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/Home_Image2.jpg
--------------------------------------------------------------------------------
/assets/img/Home_Image3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/Home_Image3.jpg
--------------------------------------------------------------------------------
/assets/img/brandfour.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/brandfour.jpeg
--------------------------------------------------------------------------------
/assets/img/brandthree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/brandthree.png
--------------------------------------------------------------------------------
/assets/img/Brands/Brands-02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/Brands/Brands-02.png
--------------------------------------------------------------------------------
/assets/img/Brands/Brands-03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/Brands/Brands-03.png
--------------------------------------------------------------------------------
/assets/img/Brands/Brands-04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/Brands/Brands-04.png
--------------------------------------------------------------------------------
/assets/img/Brands/Brands-05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/Brands/Brands-05.png
--------------------------------------------------------------------------------
/assets/img/Brands/Brands-06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vipunsanjana/E-commerce_web_application/HEAD/assets/img/Brands/Brands-06.png
--------------------------------------------------------------------------------
/server/get_featured_product.php:
--------------------------------------------------------------------------------
1 | prepare("SELECT * FROM products LIMIT 4");
6 | $stmt->execute();
7 | $featured_product = $stmt->get_result();
8 |
9 | ?>
--------------------------------------------------------------------------------
/server/get_pc.php:
--------------------------------------------------------------------------------
1 | prepare("SELECT * FROM products WHERE product_category='pc' LIMIT 4");
6 | $stmt->execute();
7 | $pc = $stmt->get_result();
8 |
9 | ?>
--------------------------------------------------------------------------------
/server/get_acceseioes.php:
--------------------------------------------------------------------------------
1 | prepare("SELECT * FROM products WHERE product_category='acceseries' LIMIT 4");
6 | $stmt->execute();
7 | $acceseries = $stmt->get_result();
8 |
9 | ?>
--------------------------------------------------------------------------------
/server/logout.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/admin/server/logout.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/connection.php:
--------------------------------------------------------------------------------
1 | connect_error) {
10 | die("Connection failed: " . $conn->connect_error);
11 | }
12 | ?>
13 |
--------------------------------------------------------------------------------
/contact.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
--------------------------------------------------------------------------------
/admin/register.php:
--------------------------------------------------------------------------------
1 | prepare($insert_sql);
13 |
14 | $hash_password=password_hash($password,PASSWORD_DEFAULT);
15 |
16 |
17 | $insert_stmt->bind_param("sss",$name,$email,$hash_password);
18 | $result=$insert_stmt->execute();
19 |
20 | if(!$result){
21 | echo $stmt->error;
22 | }
23 |
24 |
25 |
26 | header("Location: login.php?register=successfully");
27 | exit();
28 |
29 |
30 |
31 |
32 | ?>
--------------------------------------------------------------------------------
/admin/delete_user.php:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 | prepare($sql2);
23 | $stmt2->bind_param("i",$user_id);
24 | $stmt2->execute();
25 | if($stmt2->execute()){
26 |
27 | header('Location: users.php?delete_successfull_user=userdeletesuccessfully');
28 |
29 | }else{
30 |
31 | header('Location: users.php?delete_error_user=userdeleteunsuccessfully');
32 |
33 | }
34 |
35 | }
36 |
37 | }
38 |
39 |
40 | ?>
--------------------------------------------------------------------------------
/admin/delete_order.php:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 | prepare($sql2);
23 | $stmt2->bind_param("i",$order_id);
24 | $stmt2->execute();
25 | if($stmt2->execute()){
26 |
27 | header('Location: dashboard.php?delete_successfull_order=orderdeletesuccessfully');
28 |
29 | }else{
30 |
31 | header('Location: dashboard.php?delete_error_order=orderdeleteunsuccessfully');
32 |
33 | }
34 |
35 | }
36 |
37 | }
38 |
39 |
40 | ?>
--------------------------------------------------------------------------------
/admin/delete_product.php:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 | prepare($sql2);
23 | $stmt2->bind_param("i",$product_id);
24 | $stmt2->execute();
25 | if($stmt2->execute()){
26 |
27 | header('Location: product.php?delete_successfull_product=Productdeletesuccessfully');
28 |
29 | }else{
30 |
31 | header('Location: product.php?delete_error_product=Productdeleteunsuccessfully');
32 |
33 | }
34 |
35 | }
36 |
37 | }
38 |
39 |
40 | ?>
--------------------------------------------------------------------------------
/about.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
17 |
18 |
--------------------------------------------------------------------------------
/fogot_password.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/server/changePassword.php:
--------------------------------------------------------------------------------
1 | prepare($sql_update);
32 |
33 | $hashPass = password_hash($password, PASSWORD_DEFAULT);
34 |
35 | $stmt_update->bind_param("ss", $hashPass,$user_email);
36 | $stmt_update->execute();
37 |
38 |
39 | header("Location: ../account.php?passwordreset=successfully");
40 |
41 | }
42 |
43 | $stmt_update->close();
44 | $conn->close();
45 |
46 |
47 | }else{
48 |
49 | header("Location: ../account.php?error=notloggedin");
50 | exit();
51 | }
52 |
53 | ?>
--------------------------------------------------------------------------------
/server/complete_payment.php:
--------------------------------------------------------------------------------
1 | prepare($sql_update);
25 |
26 |
27 | $stmt_update->bind_param("si", $order_status,$order_id);
28 | $stmt_update->execute();
29 |
30 | $sql_one = "INSERT INTO payments (order_id,user_id,transaction_id,payment_date) VALUES (?,?,?,?);";
31 | $stmt_one = $conn->prepare($sql_one);
32 | $stmt_one->bind_param('iiss',$order_id,$user_id,$transaction_id,$payment_date);
33 | $stmt_one->execute();
34 |
35 | header("Location: ../account.php?payment_successful=paid successfully,thanks for shopping with us!");
36 |
37 | }else{
38 | header("Location: index.php");
39 | exit();
40 | }
41 |
42 |
43 |
44 |
45 |
46 |
47 | ?>
--------------------------------------------------------------------------------
/server/login.php:
--------------------------------------------------------------------------------
1 | prepare($sql);
24 |
25 | if($stmt===false){
26 |
27 | echo $conn->error;
28 |
29 | }
30 |
31 | $stmt->bind_param("s",$email);
32 | $stmt->execute();
33 |
34 | $result=$stmt->get_result();
35 |
36 | if($result->num_rows>0){
37 |
38 | $user=$result->fetch_assoc();
39 |
40 | $password_check = password_verify($password, $user['user_password']);
41 |
42 |
43 | $stmt->close();
44 | $conn->close();
45 | if($password_check){
46 |
47 | session_start();
48 |
49 | $_SESSION['user_id'] = $user['user_id'];
50 | $_SESSION['user_name'] = $user['user_name'];
51 | $_SESSION['user_email'] = $user['user_email'];
52 | $_SESSION['logged_in'] = true;
53 |
54 |
55 |
56 | header("Location: ../account.php?login=successfully");
57 | exit();
58 |
59 | }
60 |
61 | else{
62 |
63 | header("Location: ../login.php?error=wrongcredential&email=".$email);
64 | exit();
65 |
66 | }
67 |
68 | }else{
69 |
70 | header("Location: ../login.php?error=emaildoesnotexist&email=".$email);
71 | exit();
72 |
73 | }
74 | }
75 | }
76 |
77 | else{
78 |
79 | header("Location: ../register.php");
80 | exit();
81 |
82 | }
83 |
84 | ?>
--------------------------------------------------------------------------------
/admin/server/login.php:
--------------------------------------------------------------------------------
1 | prepare($sql);
24 |
25 | if($stmt===false){
26 |
27 | echo $conn->error;
28 |
29 | }
30 |
31 | $stmt->bind_param("s",$email);
32 | $stmt->execute();
33 |
34 | $result=$stmt->get_result();
35 |
36 | if($result->num_rows>0){
37 |
38 | $admin=$result->fetch_assoc();
39 |
40 | $password_check = password_verify($password, $admin['admin_password']);
41 |
42 |
43 | $stmt->close();
44 | $conn->close();
45 | if($password_check){
46 |
47 | session_start();
48 |
49 | $_SESSION['admin_id'] = $admin['admin_id'];
50 | $_SESSION['admin_name'] = $admin['admin_name'];
51 | $_SESSION['admin_email'] = $admin['admin_email'];
52 | $_SESSION['logged_in'] = true;
53 |
54 |
55 |
56 | header("Location: ../dashboard.php?login=successfully");
57 | exit();
58 |
59 | }
60 |
61 | else{
62 |
63 | header("Location: ../login.php?error=wrongcredential&email=".$email);
64 | exit();
65 |
66 | }
67 |
68 | }else{
69 |
70 | header("Location: ../login.php?error=emaildoesnotexist&email=".$email);
71 | exit();
72 |
73 | }
74 | }
75 | }
76 |
77 | else{
78 |
79 | header("Location: ../login.php");
80 | exit();
81 |
82 | }
83 |
84 | ?>
--------------------------------------------------------------------------------
/admin/help.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
15 |
16 |
17 |
18 |
26 |
27 | Help
28 |
29 |
30 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/admin/server/update_image.php:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 | prepare("UPDATE products SET product_image=?, product_image2=?, product_image3=?, product_image4=? WHERE product_id=?");
44 | $stmt->bind_param("ssssi", $image_name1, $image_name2, $image_name3, $image_name4,$product_id);
45 |
46 | if ($stmt->execute()) {
47 | header('Location: ../product.php?successfull_update_image=Productimagechangesuccessfully');
48 | } else {
49 | header('Location: ../product.php?error_update_image=Productimagechangeunsuccessfully');
50 | }
51 |
52 |
53 | $stmt->close();
54 | $conn->close();
55 |
56 |
57 | }else{
58 | header('Location: ../product.php');
59 | }
60 |
61 |
62 | }
63 |
64 |
65 | ?>
--------------------------------------------------------------------------------
/admin/account.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | prepare("SELECT * FROM admins WHERE admin_email=?");
17 | $stmt3->bind_param("i",$admin_email);
18 | $stmt3->execute();
19 | $admins = $stmt3->get_result();
20 |
21 | }else{
22 |
23 | header('Location: dashboard.php?error=cantlookadminaccount');
24 | exit();
25 |
26 | }
27 |
28 | }
29 |
30 |
31 | ?>
32 |
33 |
34 |
35 |
43 |
44 | Admin Account
45 |
46 |
47 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/admin/login.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
30 |
31 |
32 |
33 |
38 | All fields are required!
39 |
';
40 | }
41 | else if($_GET['error']=="wrongcredential"){
42 | echo '
43 | Invalid credentials!
44 |
';
45 | }
46 | else{
47 | echo '
48 | Something went wrong!
49 |
';
50 | }
51 | }
52 |
53 | ?>
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/server/place_order.php:
--------------------------------------------------------------------------------
1 | prepare($sql);
26 | $stmt->bind_param('isiisss',$order_cost,$order_status,$user_id,$phone,$city,$address,$order_date);
27 |
28 | $stmt_status = $stmt->execute();
29 |
30 | if(!$stmt_status){
31 | header("Location: ../index.php");
32 | }
33 |
34 | $order_id = $stmt->insert_id;
35 |
36 |
37 | foreach ($_SESSION['cart'] as $key => $value) {
38 |
39 | $product = $_SESSION['cart'][$key];
40 | $product_id = $product['product_id'];
41 | $product_name = $product['product_name'];
42 | $product_image = $product['product_image'];
43 | $product_price = $product['product_price'];
44 | $product_quatity = $product['product_quatity'];
45 | $order = $_SESSION['cart'][$key];
46 | $date = $order['order_date'];
47 |
48 | $sql_one = "INSERT INTO order_items (order_id,product_id,product_name,product_image,product_price,product_quatity,user_id,order_date) VALUES (?,?,?,?,?,?,?,?);";
49 | $stmt_one = $conn->prepare($sql_one);
50 | $stmt_one->bind_param('iissiiis',$order_id,$product_id,$product_name,$product_image,$product_price,$product_quatity,$user_id,$order_date);
51 | $stmt_one->execute();
52 |
53 | }
54 |
55 |
56 | // unset($_SESSION['cart']);
57 |
58 | $_SESSION['order_id'] = $order_id;
59 |
60 |
61 | header("Location: ../payment.php?order_status=order placed successfully");
62 |
63 |
64 | }
65 | }
66 |
67 |
68 | ?>
--------------------------------------------------------------------------------
/server/register.php:
--------------------------------------------------------------------------------
1 | prepare($sql);
34 |
35 | $stmt->bind_param("s",$email);
36 | $stmt->execute();
37 |
38 |
39 | $result=$stmt->get_result();
40 |
41 | if($result->num_rows > 0){
42 |
43 | $stmt->close();
44 |
45 | header("Location: ../register.php?error=emailalreadyexits&name=".$name."&email=".$email);
46 | exit();
47 | }
48 | else{
49 |
50 | $insert_sql="INSERT INTO users (user_name,user_email,user_password) VALUES (?,?,?)";
51 |
52 | $insert_stmt=$conn->prepare($insert_sql);
53 |
54 | $hash_password=password_hash($password,PASSWORD_DEFAULT);
55 |
56 |
57 | $insert_stmt->bind_param("sss",$name,$email,$hash_password);
58 | $result=$insert_stmt->execute();
59 |
60 | if(!$result){
61 | echo $stmt->error;
62 | }
63 |
64 |
65 |
66 | $user_id = $insert_stmt->insert_id;
67 | $_SESSION['user_id'] = $user_id;
68 | $_SESSION['user_email'] = $email;
69 | $_SESSION['user_name'] = $name;
70 | $_SESSION['logged_in'] = true;
71 |
72 | $insert_stmt->close();
73 | $conn->close();
74 |
75 | header("Location: ../login.php?register=successfully");
76 | exit();
77 | }
78 | }
79 | catch(mysqli_sql_exception $e){
80 | echo $e->getMessage();
81 | }
82 | }
83 | }
84 | // elseif(isset($_SESSION['logged_in'])){
85 |
86 | // header("Location: ../account.php?alreadyregisterdsuccessfully");
87 | // exit();
88 |
89 | // }
90 | else{
91 |
92 | header("Location: ../register.php?error=filltheregisterform");
93 | exit();
94 |
95 | }
96 |
97 |
98 | ?>
--------------------------------------------------------------------------------
/admin/server/create_product.php:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 | prepare("INSERT INTO products (product_name, product_category, product_description, product_image, product_image2, product_image3, product_image4, product_price, product_special_offer, product_color) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
51 | $stmt->bind_param("ssssssssss", $product_name, $product_category, $product_description, $image_name1, $image_name2, $image_name3, $image_name4, $product_price, $product_special_offer, $product_color);
52 |
53 | if ($stmt->execute()) {
54 | header('Location: ../dashboard.php?successfull_add=Productaddsuccessfully');
55 | } else {
56 | header('Location: ../dashboard.php?error_add=Productaddunsuccessfully');
57 | }
58 |
59 |
60 | $stmt->close();
61 | $conn->close();
62 |
63 |
64 | }else{
65 | header('Location: ../dashboard.php');
66 | }
67 |
68 |
69 | }
70 |
71 |
72 | ?>
--------------------------------------------------------------------------------
/server/fogot_password.php:
--------------------------------------------------------------------------------
1 | prepare($sql);
30 |
31 | $stmt->bind_param("s",$email);
32 | $stmt->execute();
33 |
34 | $result=$stmt->get_result();
35 |
36 | if($result->num_rows>0){
37 |
38 | //delete exixting token perticular user
39 | $sql_delete="DELETE FROM pwd_reset WHERE email=?";
40 |
41 | $stmt_delete=$conn->prepare($sql_delete);
42 |
43 | $stmt_delete->bind_param("s",$email);
44 | $stmt_delete->execute();
45 |
46 | //inset new token
47 | $sql_insert="INSERT INTO pwd_reset(email,selector,token,expires) VALUES(?,?,?,?)";
48 |
49 | $stmt_insert=$conn->prepare($sql_insert);
50 |
51 | //encrypt token
52 | $hash_token=password_hash($token, PASSWORD_DEFAULT);
53 |
54 | $stmt_insert->bind_param("ssss",$email,$selector,$hash_token,$expirate);
55 |
56 | $stmt_insert->execute();
57 |
58 | $to=$email;
59 | $subject="password reset request";
60 |
61 |
62 | $message = ' We receive your paswword reset request. The link toreset your password is below. if you did not request, please ignore this message.
';
63 | $message .= 'Here is your password reset link ';
64 | $message .= 'Click Here
';
65 |
66 | $headers = "From: Authentication ";
67 | $headers .= "Replty-to: vipunsanjana34@gmail.com";
68 | $headers .= "Content-type: text/html\n";
69 |
70 | mail($to, $subject, $message, $headers);
71 |
72 | header("Location:../fogot_password.php?reset=successful&url=".$url);
73 |
74 |
75 | $stmt->close();
76 | $stmt_delete->close();
77 | $stmt_insert->close();
78 | $conn->close();
79 |
80 | }
81 | else{
82 | header("Location:../fogot_password.php?error=usernotfound");
83 | }
84 | }
85 | }
86 | else{
87 | header("Location:../fogot_password.php");
88 | exit();
89 | }
90 |
91 | ?>
--------------------------------------------------------------------------------
/checkout.php:
--------------------------------------------------------------------------------
1 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/reset_password.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
21 | Could not validate your request
22 |
';
23 | }
24 | else{
25 | if(ctype_xdigit($selector) !== false && ctype_xdigit($validator) !== false){
26 | ?>
27 |
44 |
45 |
46 |
52 | Could not validate your request
53 | ';
54 | }
55 | ?>
56 |
57 |
58 |
59 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/admin/edit_image.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
24 |
25 |
26 |
27 |
35 |
36 | Update Product Image
37 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/login.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
36 |
37 |
38 |
39 |
44 | All fields are required!
45 |
';
46 | }
47 | else if($_GET['error']=="wrongcredential"){
48 | echo '
49 | Invalid credentials!
50 |
';
51 | }
52 | else{
53 | echo '
54 | Something went wrong!
55 |
';
56 | }
57 | }
58 |
59 | ?>
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/server/reset_password.php:
--------------------------------------------------------------------------------
1 | =?";
26 | $stmt=$conn->prepare($sql);
27 |
28 | $stmt->bind_param("ss",$selector,$current_time);
29 | $stmt->execute();
30 |
31 | $result=$stmt->get_result();
32 |
33 |
34 | if($result->num_rows>0){
35 |
36 | $user_token=$result->fetch_assoc();
37 |
38 | $token_bin=hex2bin($validator);
39 |
40 | $token_check=password_verify($token_bin,$user_token['token']);
41 |
42 | if($token_check===false){
43 | header("Location: ../reset_password.php?error=etokendissmathch&selector=".$selector."&validator=".$validator);
44 | exit();
45 | }
46 | else if($token_check===true){
47 | $tokenemail=$user_token['email'];
48 |
49 | $sql_select="SELECT *FROM users WHERE user_email=?;";
50 | $stmt_select=$conn->prepare($sql_select);
51 |
52 | $stmt_select->bind_param("s", $tokenemail);
53 | $stmt_select->execute();
54 |
55 | $result = $stmt_select->get_result();
56 |
57 |
58 | if($result->num_rows > 0){
59 |
60 | $sql_update = "UPDATE users SET user_password = ? WHERE user_email =?;";
61 | $stmt_update = $conn->prepare($sql_update);
62 |
63 | $hashPass = password_hash($password, PASSWORD_DEFAULT);
64 |
65 | $stmt_update->bind_param("ss", $hashPass, $tokenemail);
66 | $stmt_update->execute();
67 |
68 | $sql_delete = "DELETE FROM pwd_reset WHERE email = ?;";
69 | $stmt_delete = $conn->prepare($sql_delete);
70 |
71 |
72 | $stmt_delete->bind_param("s", $tokenemail);
73 | $stmt_delete->execute();
74 |
75 | header("Location: ../login.php?passwordreset=success");
76 |
77 | }
78 | else{
79 | header("Location: ../login.php?error=usernotfound");
80 | exit();
81 | }
82 | }
83 | else{
84 | header("Location: ../login.php?error=somethingwentwrong");
85 | exit();
86 | }
87 | }
88 | else{
89 | header("Location: ../login.php?error=nopassswordrequest");
90 | exit();
91 | }
92 |
93 | $stmt->close();
94 | $stmt_select->close();
95 | $stmt_update->close();
96 | $stmt_delete->close();
97 | $conn->close();
98 |
99 |
100 | }
101 |
102 |
103 | }
104 |
105 | else{
106 | header("Location: ../login.php");
107 | exit();
108 | }
109 |
110 |
111 | ?>
112 |
113 |
--------------------------------------------------------------------------------
/register.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
37 |
38 |
39 |
40 |
41 |
46 | All fields are required!
47 |
';
48 | }
49 | else if($_GET['error']=="emailerror"){
50 | echo '
51 | E mail format is wrong!
52 |
';
53 | }
54 | else if($_GET['error']=="passwordmistakes"){
55 | echo '
56 | Password and confirm password should be same!
57 |
';
58 | }
59 | else if($_GET['error']=="emailalreadyexits"){
60 | echo '
61 | Email alreadyexist!
62 |
';
63 | }
64 | else{
65 | echo '
66 | Something went wrong!
67 |
';
68 | }
69 | }
70 |
71 | ?>
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | ---
3 |
4 | # E-commerce Web Application (Pure PHP)
5 |
6 | Welcome to the E-commerce Web Application repository built entirely with PHP!
7 |
8 | ## Table of Contents
9 |
10 | - [Introduction](#introduction)
11 | - [Features](#features)
12 | - [Getting Started](#getting-started)
13 | - [Prerequisites](#prerequisites)
14 | - [Installation](#installation)
15 | - [Usage](#usage)
16 | - [Contributing](#contributing)
17 | - [Contact](#contact)
18 |
19 | ## Introduction
20 |
21 | This E-commerce Web Application is a full-featured, PHP-powered platform designed to provide businesses with a robust and customizable online selling solution. Whether you're starting a new e-commerce venture or looking to enhance an existing one, our application offers a range of features to streamline your online operations.
22 |
23 | ## Features
24 |
25 | - **Responsive Design**: Ensuring a seamless shopping experience across various devices.
26 | - **Product Management**: Easy product catalog management with detailed descriptions, images, and pricing.
27 | - **User Authentication**: Secure authentication and authorization mechanisms to protect user data.
28 | - **Shopping Cart**: Dynamic cart functionality for users to add, remove, and update items.
29 | - **Payment Integration**: Support for paypal payment gateways for secure transactions.
30 | - **Order Tracking**: Real-time order tracking to keep customers informed.
31 | - **Search and Filters**: Robust product search and filtering options.
32 | - **Admin Dashboard**: An intuitive dashboard for managing products, orders, and customer data.
33 | - **Customization**: Highly customizable through theming and extensible via plugins.
34 | - **Security**: Built with security best practices to protect against common web vulnerabilities.
35 | - **Scalability**: Designed to accommodate a growing user base and a large product catalog.
36 |
37 | ## Getting Started
38 |
39 | ### Prerequisites
40 |
41 | Before you begin, ensure you have met the following requirements:
42 |
43 | - [PHP](https://www.php.net/) (version X.X or higher)
44 | - [MySQL](https://www.mysql.com/) database
45 | - Web server (e.g., [Apache](https://httpd.apache.org/) or [Nginx](https://nginx.org/))
46 |
47 | ### Installation
48 |
49 | 1. Clone the repository:
50 |
51 | ```shell
52 | git clone https://github.com/vipunsanajana/e-commerce-web-app.git
53 | ```
54 |
55 | 2. Configure your web server to point to the project's root directory.
56 |
57 | 3. Create a MySQL database and configure the database settings in `config.php`.
58 |
59 | 4. Import the database schema using the provided SQL file (`database.sql`).
60 |
61 | 5. Start your web server.
62 |
63 | 6. Access the application in your web browser.
64 |
65 | ## Usage
66 |
67 | - Visit the application's homepage to start exploring and using the features.
68 | - For detailed usage instructions and customization options, refer to the w3schools.
69 |
70 | ## Contributing
71 |
72 | We welcome contributions from the open-source community. To contribute to this project, please review our project and feel free to submit pull requests.
73 |
74 | ## Contact
75 |
76 | If you have any questions, suggestions, or issues to report, please feel free to vipunsanjana34@gmail.com. We appreciate your feedback!
77 |
78 |
79 | Collaborators:
80 | - Yasith Maura
81 | - Ragapriya
82 | - Thusitha
83 | - Vipun
84 |
85 | ---
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/admin/header.php:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | Home
17 |
19 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
38 |
39 |
40 |
41 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/assets/img/ByteBeat-01.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
9 |
12 |
15 |
19 |
23 |
27 |
33 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/admin/edit_user.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | prepare("SELECT * FROM users WHERE user_id=?");
17 | $stmt3->bind_param("i",$user_id);
18 | $stmt3->execute();
19 | $users = $stmt3->get_result();
20 |
21 | }else if(isset($_POST['edit_btn'])){
22 |
23 | $user_id = $_POST['user_id'];
24 | $user_name = $_POST['name'];
25 | $user_email = $_POST['email'];
26 |
27 |
28 | $sql_update = "UPDATE users SET user_name = ?, user_email = ?
29 | WHERE user_id =?";
30 |
31 | $stmt_update = $conn->prepare($sql_update);
32 |
33 | $stmt_update->bind_param("ssi",$user_name, $user_email, $user_id);
34 |
35 | if($stmt_update->execute()){
36 |
37 | header('Location: users.php?update_successfull_user=usereditsuccessfully');
38 |
39 | }else{
40 |
41 | header('Location: users.php?update_error_user=usereditunsuccessfully');
42 |
43 | }
44 |
45 | }else{
46 |
47 | header('Location: users.php');
48 | exit();
49 |
50 | }
51 |
52 | }
53 |
54 |
55 | ?>
56 |
57 |
58 |
59 |
67 |
68 | Edit User
69 |
70 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/order_details.php:
--------------------------------------------------------------------------------
1 | prepare($sql);
16 |
17 | $stmt->bind_param("i", $order_id);
18 | $stmt->execute();
19 |
20 | $order_details = $stmt->get_result();
21 |
22 | $order_total_price = calculateTotalOrderPrice($order_details);
23 | } else {
24 | header("Location: account.php");
25 | exit();
26 | }
27 | }
28 |
29 | // Move the calculateTotalOrderPrice function outside of the else block
30 | function calculateTotalOrderPrice($order_details)
31 | {
32 | $total = 0;
33 |
34 | foreach ($order_details as $row) {
35 | $product_price = $row['product_price'];
36 | $product_quantity = $row['product_quatity'];
37 |
38 | $total = $total + ($product_price * $product_quantity);
39 | }
40 |
41 | return $total;
42 | }
43 | ?>
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
Order Details
54 |
55 |
56 |
57 |
58 |
59 | Product Name
60 | Product Price
61 | Product Quantity
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
74 |
75 |
76 |
77 |
78 | $
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
94 |
95 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/layouts/footer.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
66 |
67 |
68 |
69 |
70 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/admin/footer.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
66 |
67 |
68 |
69 |
70 |
73 |