diff --git a/README.md b/README.md index ad64aa9..89aa417 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Buy Me A Coffee -> ## Updated project with extra Features like WISHLIST, List Orders, add Reviews, updated routing, resolved search bug is available for Premium +> ## Updated project with extra Features like WISHLIST, List Orders, add Reviews, updated routing, resolved search bug is available for Premium [![Youtube Video](https://img.youtube.com/vi/gLwfj67GI8A/0.jpg)](https://youtu.be/gLwfj67GI8A) @@ -20,13 +20,13 @@ online shopping system is a [DBMS project] with both admin and user layouts. 2. Open XAMPP Control panal and start [apache] and [mysql] . -3. Download project from github(https://github.com/PuneethReddyHC/online-shopping-system-with-advanced-admin-page.git) +3. Download project from github(https://github.com/PuneethReddyHC/online-shopping-system-with-advanced-admin-page.git) OR follow gitbash commands - + i>cd C:\\xampp\htdocs\ - + ii>git clone https://github.com/PuneethReddyHC/online-shopping-system-with-advanced-admin-page.git - + 4. extract files in C:\\xampp\htdocs\. 5. open link localhost/phpmyadmin @@ -45,9 +45,9 @@ online shopping system is a [DBMS project] with both admin and user layouts. 12. first register and then login -13. admin login details Email=admin@gmail.com or username = admin and Password=123456789. +13. admin login details Email=admin@gmail.com and Password=123456789. -## If you like my project +## If you like my project Bye me Cup of coffee ### Google pay or phonepay number 9535688928 diff --git a/js/actions.js b/js/actions.js index ac21ef7..69132e3 100644 --- a/js/actions.js +++ b/js/actions.js @@ -3,10 +3,10 @@ $(document).ready(function(){ cathome(); brand(); product(); - + producthome(); - - + + //cat() is a funtion fetching category record from database whenever page is load function cat(){ $.ajax({ @@ -15,7 +15,7 @@ $(document).ready(function(){ data : {category:1}, success : function(data){ $("#get_category").html(data); - + } }) } @@ -26,7 +26,7 @@ $(document).ready(function(){ data : {categoryhome:1}, success : function(data){ $("#get_category_home").html(data); - + } }) } @@ -73,16 +73,16 @@ $(document).ready(function(){ } }) } - - - /* when page is load successfully then there is a list of categories when user click on category we will get category id and + + + /* when page is load successfully then there is a list of categories when user click on category we will get category id and according to id we will show products */ $("body").delegate(".category","click",function(event){ $("#get_product").html("

Loading...

"); event.preventDefault(); var cid = $(this).attr('cid'); - + $.ajax({ url : "action.php", method : "POST", @@ -94,13 +94,13 @@ $(document).ready(function(){ } } }) - + }) $("body").delegate(".categoryhome","click",function(event){ $("#get_product").html("

Loading...

"); event.preventDefault(); var cid = $(this).attr('cid'); - + $.ajax({ url : "homeaction.php", method : "POST", @@ -112,17 +112,17 @@ $(document).ready(function(){ } } }) - + }) - /* when page is load successfully then there is a list of brands when user click on brand we will get brand id and + /* when page is load successfully then there is a list of brands when user click on brand we will get brand id and according to brand id we will show products */ $("body").delegate(".selectBrand","click",function(event){ event.preventDefault(); $("#get_product").html("

Loading...

"); var bid = $(this).attr('bid'); - + $.ajax({ url : "action.php", method : "POST", @@ -134,12 +134,12 @@ $(document).ready(function(){ } } }) - + }) /* - At the top of page there is a search box with search button when user put name of product then we will take the user - given string and with the help of sql query we will match user given string to our database keywords column then matched product - we will show + At the top of page there is a search box with search button when user put name of product then we will take the user + given string and with the help of sql query we will match user given string to our database keywords column then matched product + we will show */ $("#search_btn").click(function(){ $("#get_product").html("

Loading...

"); @@ -149,7 +149,7 @@ $(document).ready(function(){ url : "action.php", method : "POST", data : {search:1,keyword:keyword}, - success : function(data){ + success : function(data){ $("#get_product").html(data); if($("body").width() < 480){ $("body").scrollTop(683); @@ -164,7 +164,7 @@ $(document).ready(function(){ /* Here #login is login form id and this form is available in index.php page from here input data is sent to login.php page - if you get login_success string from login.php page means user is logged in successfully and window.location is + if you get login_success string from login.php page means user is logged in successfully and window.location is used to redirect user from home page to profile.php page */ $("#login").on("submit",function(event){ @@ -176,10 +176,12 @@ $(document).ready(function(){ data :$("#login").serialize(), success :function(data){ if(data == "login_success"){ + $('#class-toggle').hide(); window.location.href = "index.php"; }else if(data == "cart_login"){ window.location.href = "cart.php"; }else{ + $('#class-toggle').show(); $("#e_msg").html(data); $(".overlay").hide(); } @@ -203,12 +205,12 @@ $(document).ready(function(){ }else{ $("#signup_msg").html(data); } - + } }) }) - - + + $("#offer_form").on("submit",function(event){ event.preventDefault(); $(".overlay").show(); @@ -219,19 +221,19 @@ $(document).ready(function(){ success : function(data){ $(".overlay").hide(); $("#offer_msg").html(data); - + } }) }) - - - + + + //Get User Information before checkout end here //Add Product into Cart $("body").delegate("#product","click",function(event){ var pid = $(this).attr("pid"); - + event.preventDefault(); $(".overlay").show(); $.ajax({ @@ -271,7 +273,7 @@ $(document).ready(function(){ success : function(data){ $("#cart_product").html(data); net_total(); - + } }) } @@ -282,7 +284,7 @@ $(document).ready(function(){ Whenever user change qty we will immediate update their total amount by using keyup funtion but whenever user put something(such as ?''"",.()''etc) other than number then we will make qty=1 if user put qty 0 or less than 0 then we will again make it 1 qty=1 - ('.total').each() this is loop funtion repeat for class .total and in every repetation we will perform sum operation of class .total value + ('.total').each() this is loop funtion repeat for class .total and in every repetation we will perform sum operation of class .total value and then show the result into class .net_total */ $("body").delegate(".qty","keyup",function(event){ @@ -305,14 +307,14 @@ $(document).ready(function(){ $('.net_total').html("Total : $ " +net_total); }) - //Change Quantity end here + //Change Quantity end here /* - whenever user click on .remove class we will take product id of that row + whenever user click on .remove class we will take product id of that row and send it to action.php to perform product removal operation */ - - + + $("body").delegate(".remove","click",function(event){ var remove = $(this).parent().parent().parent(); var remove_id = remove.find(".remove").attr("remove_id"); @@ -326,10 +328,10 @@ $(document).ready(function(){ } }) }) - - + + /* - whenever user click on .update class we will take product id of that row + whenever user click on .update class we will take product id of that row and send it to action.php to perform product qty updation operation */ $("body").delegate(".update","click",function(event){ @@ -354,7 +356,7 @@ $(document).ready(function(){ checkOutDetails() function work for two purposes First it will enable php isset($_POST["Common"]) in action.php page and inside that there is two isset funtion which is isset($_POST["getCartItem"]) and another one is isset($_POST["checkOutDetials"]) - getCartItem is used to show the cart item into dropdown menu + getCartItem is used to show the cart item into dropdown menu checkOutDetails is used to show cart item into Cart.php page */ function checkOutDetails(){ diff --git a/login.php b/login.php index fc67ddd..a7cc4bc 100644 --- a/login.php +++ b/login.php @@ -5,7 +5,7 @@ #Login script is begin here #If user given credential matches successfully with the data available in database then we will echo string login_success -#login_success string will go back to called Anonymous funtion $("#login").click() +#login_success string will go back to called Anonymous funtion $("#login").click() if(isset($_POST["email"]) && isset($_POST["password"])){ $email = mysqli_real_escape_string($con,$_POST["email"]); @@ -13,20 +13,25 @@ $sql = "SELECT * FROM user_info WHERE email = '$email' AND password = '$password'"; $run_query = mysqli_query($con,$sql); $count = mysqli_num_rows($run_query); - $row = mysqli_fetch_array($run_query); - $_SESSION["uid"] = $row["user_id"]; - $_SESSION["name"] = $row["first_name"]; - $ip_add = getenv("REMOTE_ADDR"); - //we have created a cookie in login_form.php page so if that cookie is available means user is not login - + + //if user record is available in database then $count will be equal to 1 if($count == 1){ - + /* + moving this block of codes to fixed error when theres count > 0 + Issue Error during Login #21 + */ + $row = mysqli_fetch_array($run_query); + $_SESSION["uid"] = $row["user_id"]; + $_SESSION["name"] = $row["first_name"]; + $ip_add = getenv("REMOTE_ADDR"); + //we have created a cookie in login_form.php page so if that cookie is available means user is not login + if (isset($_COOKIE["product_list"])) { $p_list = stripcslashes($_COOKIE["product_list"]); //here we are decoding stored json product list cookie to normal array $product_list = json_decode($p_list,true); - for ($i=0; $i < count($product_list); $i++) { + for ($i=0; $i < count($product_list); $i++) { //After getting user id from database here we are checking user cart item if there is already product is listed or not $verify_cart = "SELECT id FROM cart WHERE user_id = $_SESSION[uid] AND p_id = ".$product_list[$i]; $result = mysqli_query($con,$verify_cart); @@ -44,10 +49,8 @@ setcookie("product_list","",strtotime("-1 day"),"/"); //if user is logging from after cart page we will send cart_login echo "cart_login"; - - exit(); - + } //if user is login from page we will send login_success echo "login_success"; @@ -55,46 +58,40 @@ if(!isset($BackToMyPage)) { header('Location: '.$BackToMyPage); echo""; } else { echo "" ;// default page - } - - + } + + exit; + }else{ + $email = mysqli_real_escape_string($con,$_POST["email"]); + $password =md5($_POST["password"]) ; + $sql = "SELECT * FROM admin_info WHERE admin_email = '$email' AND admin_password = '$password'"; + $run_query = mysqli_query($con,$sql); + $count = mysqli_num_rows($run_query); + + //if user record is available in database then $count will be equal to 1 + if($count == 1){ + $row = mysqli_fetch_array($run_query); + $_SESSION["uid"] = $row["admin_id"]; + $_SESSION["name"] = $row["admin_name"]; + $ip_add = getenv("REMOTE_ADDR"); + //we have created a cookie in login_form.php page so if that cookie is available means user is not login + + + //if user is login from page we will send login_success + echo "login_success"; + + echo ""; + exit; + }else{ - $email = mysqli_real_escape_string($con,$_POST["email"]); - $password =md5($_POST["password"]) ; - $sql = "SELECT * FROM admin_info WHERE admin_email = '$email' AND admin_password = '$password'"; - $run_query = mysqli_query($con,$sql); - $count = mysqli_num_rows($run_query); - - //if user record is available in database then $count will be equal to 1 - if($count == 1){ - $row = mysqli_fetch_array($run_query); - $_SESSION["uid"] = $row["admin_id"]; - $_SESSION["name"] = $row["admin_name"]; - $ip_add = getenv("REMOTE_ADDR"); - //we have created a cookie in login_form.php page so if that cookie is available means user is not login - - - //if user is login from page we will send login_success - echo "login_success"; - - echo ""; - exit; - - }else{ - echo "Please register before login..!"; - exit(); - } - - + echo "Email / Password Incorrect !"; + exit(); + } + } } - - -} - -?> \ No newline at end of file diff --git a/login_form.php b/login_form.php index d73847e..122b88b 100644 --- a/login_form.php +++ b/login_form.php @@ -18,63 +18,67 @@
- +
- - + + - - + +

Login Here

- - + +
- +
- +
- + - + - - - - - - + + + + + +
- +
- + - + - +
- + - +
\ No newline at end of file