Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/ecommerce-master.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions admin/assets/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,7 @@ a, a:hover, a:focus {
color: #fff;
background: #6d7fcc;
}

#content {
width: 100%;
}
28 changes: 26 additions & 2 deletions admin/index.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<?php
include ('functions/db_connect.php')
?>
<!DOCTYPE html>
<html lang="en">
<head>
Expand All @@ -10,6 +13,7 @@
<link rel="stylesheet" type="text/css" href="assets/css/custom.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css">
<title>E-commerce Admin Panel</title>
<title>Admin Panel</title>
</head>
<body>
<div class="wrapper">
Expand All @@ -24,12 +28,12 @@
</a>
</li>
<li>
<a href="index.php?view_products">
<a href="index.php?view">
<i class="fas fa-sitemap"></i> View All Products
</a>
</li>
<li>
<a href="index.php?insert_category">Insert New Category</a>
<a href="index.php?insert_categories">Insert New Category</a>
</li>
<li>
<a href="index.php?view_categories">View All Categories</a>
Expand Down Expand Up @@ -62,6 +66,26 @@
</button>
</div>
</nav>
<div class="container">
<?php
if(isset($_GET['insert_product'])){
include ('insert_product.php');
}
else if(isset($_GET['view'])){
include ('view.php');
}
else if(isset($_GET['view_categories'])){
include ('view_categories.php');
}
else if(isset($_GET['view_customers'])){
include ('view_customers.php');
}
else if(isset($_GET['view_brands'])) {
include('view_brands.php');
}

?>
</div>
</div>
</div>
<script src="assets/js/jquery-3.3.1.min.js"></script>
Expand Down
156 changes: 78 additions & 78 deletions admin/insert_product.php
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
<?php
require "../includes/db_connetion.php";
?>
<html>
<head>
<title> Inserting Product</title>
<!--<script src="https://cloud.tinymce.com/stable/tinymce.min.js"></script>
<script>tinymce.init({ selector:'textarea' });</script>-->
</head>
<body>
<form action="insert_product.php" method="post" enctype="multipart/form-data">
<table align="center" width="750" border="2" bgcolor="orange">
<tr align="center">
<td colspan="2"><h2>Insert New Product here</h2></td>
</tr>
<tr>
<td align="right"><b> Product Title: </b></td>
<td><input type="text" name="pro_title" size="60" required></td>
</tr>
<tr>
<td align="right"><b> Product Category: </b></td>
<td>
<select name="pro_cat" required>
<option>Select a Category</option>
<?php
$get_cats = "select * from categories";
$run_cats = mysqli_query($con, $get_cats);
while ($row_cats= mysqli_fetch_array($run_cats)){
$cat_id = $row_cats['cat_id'];
$cat_title = $row_cats['cat_title'];
echo "<option value='$cat_id'>$cat_title </option>";
}
?>
</select>
</td>
</tr>
<tr>
<td align="right"><b> Product Brand: </b></td>
<td>
<select name="pro_brand" required>
<option>Select a Brand</option>
<?php
$get_brands = "select * from brands";
$run_brands = mysqli_query($con, $get_brands);
while ($row_brands= mysqli_fetch_array($run_brands)){
$brand_id = $row_brands['brand_id'];
$brand_title = $row_brands['brand_title'];
echo "<option value='$brand_id'>$brand_title </option>";
}
?>
</select>
</td>
</tr>
<tr>
<td align="right"><b> Product Image: </b></td>
<td><input type="file" name="pro_image" required></td>
</tr>
<tr>
<td align="right"><b> Product Price: </b></td>
<td><input type="text" name="pro_price" required></td>
</tr>
<tr>
<td align="right"><b> Product Description: </b></td>
<td><textarea name="pro_desc" cols="40" rows="10"></textarea></td>
</tr>
<tr>
<td align="right"><b> Product Keywords: </b></td>
<td><input type="text" name="pro_keywords" size="50" required></td>
</tr>
<tr align="center">
<td colspan="2"><input type="submit" name="insert_post" value="Insert Product Now"></td>
</tr>

</table>

<div class="row">
<div class="offset-md-2 col-md-8">
<form action="" method="post" enctype="multipart/form-data">
<div class="form-group row">
<h2 class="offset-lg-3 offset-md-2 offset-1 "> Insert New Product </h2>
</div>
<div class="form-group row">
<label class="col-form-label col-sm-4 col-lg-3 d-none d-sm-block" for="pro_title">Product Title</label>
<div class="col-12 col-sm-8 col-lg-9">
<input class="form-control" type="text" id="pro_title" name="pro_title" placeholder="Title">
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-sm-4 col-lg-3 d-none d-sm-block" for="pro_cat">Product Category</label>
<div class="col-12 col-sm-8 col-lg-9">
<select name="pro_cat" id="pro_cat" required class="form-control">
<option>Select Category</option>
<?php
$get_cats = "select * from categories";
$run_cats = mysqli_query($con, $get_cats);
while ($row_cats= mysqli_fetch_array($run_cats)){
$cat_id = $row_cats['cat_id'];
$cat_title = $row_cats['cat_title'];
echo "<option value='$cat_id'>$cat_title </option>";
}
?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-sm-4 col-lg-3 d-none d-sm-block" for="pro_brand">Product Brand</label>
<div class="col-12 col-sm-8 col-lg-9">
<select name="pro_brand" id="pro_brand" required class="form-control">
<option>Select Brand</option>
<?php
$get_brands = "select * from brands";
$run_brands = mysqli_query($con, $get_brands);
while ($row_brands= mysqli_fetch_array($run_brands)){
$brand_id = $row_brands['brand_id'];
$brand_title = $row_brands['brand_title'];
echo "<option value='$brand_id'>$brand_title </option>";
}
?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-sm-4 col-lg-3 d-none d-sm-block" for="pro_image">Product Image</label>
<div class="col-12 col-sm-8 col-lg-9">
<input class="form-control-file" type="file" id="pro_image" name="pro_image">
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-sm-4 col-lg-3 d-none d-sm-block" for="pro_price">Product Price</label>
<div class="col-12 col-sm-8 col-lg-9">
<input class="form-control" type="text" id="pro_price" name="pro_price" placeholder="Product Price">
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-sm-4 col-lg-3 d-none d-sm-block" for="pro_desc">Product Description</label>
<div class="col-12 col-sm-8 col-lg-9">
<textarea class="form-control" name="pro_desc" id="pro_desc" rows="4" placeholder="Product Description"></textarea>
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-sm-4 col-lg-3 d-none d-sm-block" for="pro_keywords">Product Keywords</label>
<div class="col-12 col-sm-8 col-lg-9">
<input class="form-control" type="text" id="pro_keywords" name="pro_keywords" placeholder="Product Keywords">
</div>
</div>
<div class="form-group row">
<div class="offset-sm-3 col-12 col-sm-6">
<input class="btn btn-block btn-primary btn-lg" type="submit" id="insert_post" name="insert_post"
value="Insert Product Now">
</div>
</div>
</form>
</body>
</html>

</div>
</div>
<?php
if(isset($_POST['insert_post'])){
//getting text data from the fields
Expand Down
36 changes: 36 additions & 0 deletions admin/view.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<h1> All product </h1>
<ul class="list-group">
<?php

$get_pro = "";
if(!isset($_GET['cat']) && !isset($_GET['brand']) && !isset($_GET['search'])) {

$get_pro = "select * from products";

$get_pro = "select * from products order by RAND() limit 0,6";


}
$run_pro = mysqli_query($con,$get_pro);
$count_pro = mysqli_num_rows($run_pro);


while($row_pro = mysqli_fetch_array($run_pro)){
$pro_id = $row_pro['pro_id'];
$pro_cat = $row_pro['pro_cat'];
$pro_brand = $row_pro['pro_brand'];
$pro_title = $row_pro['pro_title'];
$pro_price = $row_pro['pro_price'];
$pro_image = $row_pro['pro_image'];
echo"<td>

<tr> <td>$pro_title</td>


<td><img src='product_images/$pro_image' width='100px' height='100px'></td>

<td>$pro_price</td><br></tr>
</td>";
}
?>
</ul>
50 changes: 50 additions & 0 deletions change_pass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
$err_msg = '';
$no_match_err = '';
if(isset($_POST['change_pass'])){
$user = $_SESSION['customer_email'];
$current_pass = $_POST['current_pass'];
$new_pass = $_POST['new_pass'];
$confirm_pass = $_POST['confirm_pass'];

$sel_pass = "select * from customers where cust_pass = '$current_pass'
AND cust_email='$user'";
$run_pass = mysqli_query($con,$sel_pass);
$check_pass = mysqli_num_rows($run_pass);
if($check_pass == 0){
$err_msg = 'Your current Password is wrong';
}else {
if ($new_pass != $confirm_pass) {
$no_match_err = 'Confirm Password do not match!';
}else{
$update_pass = "update customers set cust_pass = '$new_pass' where cust_email='$user'";
$run_update = mysqli_query($con,$update_pass);
header('location: my_account.php');
}
}
}
?>
<h2 style="text-align: center"> Change Your Password</h2>
<div><b style="color: red"><?php echo $err_msg;?></b></div>
<div><b style="color: red"><?php echo $no_match_err;?></b></div>

<form action="" method="post">
<table align="center" width="700">
<tr>
<td align="right"><b>Enter Current Password:</b></td>
<td><input type="password" name="current_pass" required></td>
</tr>
<tr>
<td align="right"><b>Enter New Password:</b></td>
<td> <input type="password" name="new_pass" required></td>
</tr>
<tr>
<td align="right"><b>Confirm Password:</b></td>
<td><input type="password" name="confirm_pass" required></td>
</tr>
<tr align="center">
<td colspan="3"><input type="submit" name="change_pass" value="Change Password"></td>
</tr>

</table>
</form>