+ ";
+ }
+}
+//getting the user IP address
+function getIp() {
+ $ip = $_SERVER['REMOTE_ADDR'];
+
+ if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
+ $ip = $_SERVER['HTTP_CLIENT_IP'];
+ } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
+ $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
+ }
+ return $ip;
+}
+//creating the shopping cart
+function cart(){
+ if(isset($_GET['add_cart'])){
+ global $con;
+ $ip = getIp();
+ $pro_id = $_GET['add_cart'];
+ $check_pro = "select * from cart where ip_add = '$ip' AND p_id='$pro_id '";
+ $run_check = mysqli_query($con,$check_pro);
+ if(mysqli_num_rows($run_check)>0){
+ echo "";
+ } else {
+ $insert_pro = "insert into cart (p_id, ip_add) VALUES
+ ('$pro_id','$ip')";
+ $run_pro = mysqli_query($con,$insert_pro);
+ if($run_pro)
+ header('location:'.$_SERVER['PHP_SELF']);
+ }
+ }
+}
+//getting the total added items.
+function total_items(){
+ global $con;
+ $ip = getIp();
+ $get_items = "select * from cart where ip_add='$ip'";
+ $run_items = mysqli_query($con,$get_items);
+ $count_items = 0;
+ while($row = mysqli_fetch_array($run_items))
+ $count_items += $row['qty'];
+ echo $count_items;
+}
+//getting the total price of the items in the cart
+function total_price(){
+ global $con;
+ $ip = getIp();
+ $total = 0;
+ $sel_price = "select * from cart where ip_add = '$ip'";
+ $run_price = mysqli_query($con,$sel_price);
+ while($cart_row = mysqli_fetch_array($run_price)){
+ $pro_id = $cart_row['p_id'];
+ $pro_qty = $cart_row['qty'];
+ $pro_price = "select * from products where pro_id = '$pro_id'";
+ $run_pro_price = mysqli_query($con, $pro_price);
+ while ($pro_row = mysqli_fetch_array($run_pro_price)){
+ $pro_price = $pro_row['pro_price'];
+ $pro_price_all_items = $pro_price * $pro_qty;
+ $total += $pro_price_all_items;
+ }
+ }
+ echo 'Rs '.$total.'/-';
+}
diff --git a/admin/index.php b/admin/index.php
index 29e7a82..94f7bf3 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -1,3 +1,9 @@
+
+
@@ -10,6 +16,13 @@
E-commerce Admin Panel
+ Admin Panel
+
@@ -62,6 +75,35 @@
+
+
+
diff --git a/admin/insert_brand.php b/admin/insert_brand.php
new file mode 100644
index 0000000..9d70967
--- /dev/null
+++ b/admin/insert_brand.php
@@ -0,0 +1,25 @@
+
+
+
\ No newline at end of file
diff --git a/admin/insert_category.php b/admin/insert_category.php
new file mode 100644
index 0000000..07cc4a0
--- /dev/null
+++ b/admin/insert_category.php
@@ -0,0 +1,25 @@
+
+
+
\ No newline at end of file
diff --git a/admin/insert_product.php b/admin/insert_product.php
index 344fcb6..8f54467 100644
--- a/admin/insert_product.php
+++ b/admin/insert_product.php
@@ -1,82 +1,83 @@
-
-
-
- Inserting Product
-
-
-
-