58C - HTML - CSS - JAVASCRIPT - PHP - 211-15-3966 - WEB - LEB - REPORT (AutoRecovered)
58C - HTML - CSS - JAVASCRIPT - PHP - 211-15-3966 - WEB - LEB - REPORT (AutoRecovered)
Website
Introduction
Github Link :
The e-commerce website project aims to
provide users with a platform to browse and https://github.com/Haider3966/Responsive_e-
purchase products online. It facilitates commarce-website2024/commits/main/
administrators in managing the system
efficiently and users in shopping conveniently
from various categories.
Admin Login
System Overview
• Secure login functionality for administrators to
• Purpose: The purpose of the project is to access the dashboard.
create a user-friendly and robust e-
commerce platform where users can view, Dashboard
search, and purchase products, while
administrators can manage products, • Overview of system statistics, orders, and other
orders, and users. relevant information for administrators.
• Scope: The system includes modules for
both administrators and users, covering
Message
features such as product management, user
authentication, order processing,
messaging, and more. • Communication module allowing users to send
messages to administrators.
Technologies Used
Placed Order
The project utilizes the following
• Management of orders placed by users,
technologies:
including order details and status tracking.
• Programming Languages: PHP, HTML,
CSS, JavaScript
Product
• Database: MySQL
• Frameworks/Libraries: None • CRUD operations for managing products,
• Development Tools: Text editors, including adding, editing, and deleting
phpMyAdmin products.
• Web Server: Apache
• Operating System: Any OS supporting Registered Admin
PHP, MySQL, and Apache (e.g.,
Windows, Linux) • Management of registered administrators,
including profile updates and password
Modules and Functionality changes.
• Consistent header section for • Shopping cart functionality for users to add and
administrator-related pages. manage items for purchase.
User Register
Wishlist
$delete_id = $_GET['delete'];
• Management of user wishlist.
$delete_admins = $conn-
Applications HTML
admin_accounts.php : $delete_admins-
>execute([$delete_id]);
<?php
header('location:admin_accounts.php');
include '../components/connect.php';
session_start();
?>
$admin_id = $_SESSION['admin_id'];
<!DOCTYPE html>
<html lang="en">
if(!isset($admin_id)){
<head>
<meta charset="UTF-8">
header('location:admin_login.php');
<meta http-equiv="X-UA-Compatible"
}
content="IE=edge">
<meta name="viewport"
scale=1.0"> Accounts</h1>
<title>Admin Accounts</title>
<div class="box-container">
<link rel="stylesheet"
class="option-btn">Register Admin</a>
href="../css/admin_style.css">
<?php
$select_accounts->execute();
<section class="accounts">
while($fetch_accounts = echo '<a
>fetch(PDO::FETCH_ASSOC)){ btn">update</a>';
?> }
$fetch_accounts['name']; ?></span> }
</p> }else{
href="admin_accounts.php?delete=<?= }
btn">delete</a>
<?php </section>
if($fetch_accounts['id']
== $admin_id){
session_start();
if(isset($_POST['submit'])){
$name = $_POST['name'];
$name = filter_var($name,
FILTER_SANITIZE_STRING);
$pass = sha1($_POST['pass']);
$pass = filter_var($pass,
<script
FILTER_SANITIZE_STRING);
src="../js/admin_script.js"></script>
$select_admin = $conn-
</body>
>prepare("SELECT * FROM `admins` WHERE
</html>
name = ? AND password = ?");
$select_admin->execute([$name,
admin_login.php :
$pass]);
<?php
$row = $select_admin-
>fetch(PDO::FETCH_ASSOC);
include '../components/connect.php';
if($select_admin->rowCount() > 0){ <meta name="viewport"
$row['id']; scale=1.0">
<title>Login</title>
header('location:dashboard.php');
} awesome/6.1.1/css/all.min.css">
} <link rel="stylesheet"
href="../css/admin_style.css">
?>
</head>
<html lang="en">
<head> <?php
<span>'.$message.'</span> oninput="this.value =
'; oninput="this.value =
} this.value.replace(/\s/g, '')">
</form>
<section class="form-container">
</section>
dashboard.php :
<span>admin</span> & password =
<span>111</span></p> <?php
content="width=device-width, initial-
session_start(); scale=1.0">
<title>Dashboard</title>
$admin_id = $_SESSION['admin_id'];
<link rel="stylesheet"
if(!isset($admin_id)){ href="https://cdnjs.cloudflare.com/ajax/
libs/font-
header('location:admin_login.php'); awesome/6.1.1/css/all.min.css">
<link rel="stylesheet"
?> href="../css/admin_style.css">
<head>
content="IE=edge">
<section class="dashboard">
$select_pendings-
if($select_pendings-
while($fetch_pendings =
<h3>Welcome!</h3> >fetch(PDO::FETCH_ASSOC)){
<p><?= $total_pendings +=
<a href="update_profile.php" }
class="btn">Update Profile</a> }
</div> ?>
<h3><span>Nrs.</span><?=
<div class="box">
<?php <p>Completed orders</p>
>execute(['completed']); <?php
while($fetch_completes $select_orders->execute();
= $select_completes- $number_of_orders =
>fetch(PDO::FETCH_ASSOC)){ $select_orders->rowCount()
$total_completes += ?>
} ?></h3>
} <p>Orders Placed.</p>
</span></h3>
<div class="box"> $select_users->execute();
<?php $number_of_users =
>execute(); ?></h3>
?></h3>
$select_admins->execute();
<?php $select_admins->rowCount()
<a href="admin_accounts.php"
</div>
</section>
<div class="box">
<?php
$select_messages = $conn-
$select_messages-
>execute();
$number_of_messages =
$select_messages->rowCount()
?>
<h3><?= $number_of_messages;
?></h3>
<p>New messages</p>
<script if(isset($_GET['delete'])){
$delete_message = $conn-
</html> id = ?");
messages.php:
$delete_message-
<?php >execute([$delete_id]);
header('location:messages.php');
include '../components/connect.php'; }
session_start(); ?>
<html lang="en">
if(!isset($admin_id)){ <head>
<meta charset="UTF-8">
}; content="IE=edge">
<meta name="viewport"
scale=1.0">
awesome/6.1.1/css/all.min.css"> $select_messages->execute();
if($select_messages->rowCount() >
href="../css/admin_style.css"> while($fetch_message =
$select_messages-
</head> >fetch(PDO::FETCH_ASSOC)){
<body> ?>
<div class="box">
$fetch_message['email']; ?>
?></span></p>
$fetch_message['number'];
?></span></p> </section>
$fetch_message['message'];
?></span></p>
<a href="messages.php??delete=<?=
$fetch_message['id']; ?>"
message?');" class="delete-
btn">Delete</a>
</div>
<?php
}else{
<script
echo '<p class="empty">you
src="../js/admin_script.js"></script>
have no messages</p>';
<header class="header">
</body>
Code of Components
admin_header.php
<a href="../admin/dashboard.php"
<?php class="logo">Admin<span>Panel</span></a>
if(isset($message)){
<span>'.$message.'</span> <a
onclick="this.parentElement.remove(); >
"></i> <a
</div> href="../admin/placed_orders.php">Orders
'; </a>
} <a
} href="../admin/admin_accounts.php">Admin
?> s</a>
<a $select_profile-
href="../admin/users_accounts.php">Us >execute([$admin_id]);
ers</a> $fetch_profile =
<a $select_profile-
href="../admin/messages.php">Messages >fetch(PDO::FETCH_ASSOC);
</a> ?>
?></p>
</div> href="../admin/register_admin.php"
class="option-btn">Register</a>
<?php href="../admin/admin_login.php"
WHERE id = ?");
<a header('location:../admin/admin_login.ph
href="../components/admin_logout.php" p');
class="delete-btn" onclick="return
connect.php:
website?');">logout</a>
</div>
<?php
</section>
$db_name =
'mysql:host=localhost;dbname=shop_db';
</header>
$user_name = 'root';
admin_logout.php:
$user_password = '';
<?php
session_start(); ?>
Code of CSS
session_unset();
admin_style.css
session_destroy();
@import
url('https://fonts.googleapis.com/css box-sizing: border-box;
:root{
--main-color:#2980b9; *::selection{
--red:#e74c3c; color:var(--white);
--black:#444; }
--white:#fff;
--light-color:#777; ::-webkit-scrollbar{
rgba(0,0,0,.1);
} ::-webkit-scrollbar-track{
background-color: transparent;
*{ }
} color:var(--black);
margin-bottom: 2rem;
overflow-x: hidden; }
.btn,
body{ .delete-btn,
} width: 100%;
margin-top: 1rem;
} color:var(--white);
cursor: pointer;
text-align: center; }
.flex-btn{
.delete-btn:hover, gap:1rem;
.option-btn:hover{ }
background-color: var(--black);
} .message{
position: sticky;
.btn{ top:0;
} background-color: var(--light-bg);
padding:2rem;
} justify-content: space-between;
gap:1.5rem;
background-color: var(--red); }
box-shadow: var(--box-shadow);
} font-size: 2rem;
text-transform: capitalize;
.message i{ }
cursor: pointer;
} transform: translateY(1rem);
.message i:hover{ }
color:var(--black);
} .form-container{
min-height: 100vh;
border: var(--border); }
color:var(--light-color);
text-align: center; }
box-shadow: var(--box-shadow);
width: 50rem; }
border:var(--border);
width: 100%;
} color:var(--black);
.form-container form p{
background-color: var(--white);
} font-size: 2rem;
color:var(--black);
.header .flex{ }
display: flex;
} }
} cursor: pointer;
color:var(--black);
color:var(--main-color);
text-align: center;
background-color: var(--white); }
border-radius: .5rem;
padding:2rem; }
width: 30rem;
gap:1.5rem;
background-color: var(--white); }
.add-products form{
} box-shadow: var(--box-shadow);
border:var(--border);
span{ padding:2rem;
font-size: 2rem; }
padding:1.4rem;
gap:1.5rem; }
flex-wrap: wrap;
height: 5.4rem;
flex:1 1 25rem; }
.show-products .box-container{
} gap:1.5rem;
justify-content: center;
font-size: 1.8rem; }
background-color: var(--light-bg);
padding:2rem; color:var(--main-color);
} margin:.5rem 0;
} }
} border:var(--border);
padding:2rem; gap:1rem;
} }
} width: 7rem;
object-fit: contain;
object-fit: contain; }
display: flex; }
.update-product form .box{ .orders .box-container{
margin:1rem 0; }
} border:var(--border);
background-color: var(--white);
height: 15rem; }
resize: none;
} fit, 33rem);
gap:1.5rem;
} }
border:var(--border); }
}
.accounts .box-container .box p{ padding:2rem;
} background-color: var(--white);
box-shadow: var(--box-shadow);
color:var(--main-color);
line-height: 1.5;
grid-template-columns: margin:1rem 0;
repeat(auto-fit, 33rem); }
gap:1.5rem;
} }
@media (max-width:768px){
#menu-btn{
display: inline-block;
position: absolute;
border-top: var(--border);
border-bottom: var(--border);
background-color: var(--white);
@media (max-width:991px){
transition: .2s linear;
html{
100% 0, 0 0);
font-size: 55%;
}
font-size: 3.5rem;
} flex-flow: column;
gap:0;
display: block;
} height:15rem;
.show-products .box-container{
html{
} grid-template-columns: 1fr;
.heading{
.accounts .box-container{ navbar.classList.toggle('active');
} }
} profile.classList.toggle('active');
navbar.classList.remove('active');
} }
Code of JS
admin_script.js:
window.onscroll = () =>{
.navbar'); }
let profile =
.profile'); document.querySelector('.update-product
img');
subImages.forEach(images =>{
images.onclick = () =>{
src =
images.getAttribute('src');
mainImage.src = src;
});
Project View
References
• PHP Manual:
https://www.php.net/manual/en/
• MySQL Documentation:
https://dev.mysql.com/doc/
• W3Schools: https://www.w3schools.com/
• MDN Web Docs:
https://developer.mozilla.org/en-US/
End