Skip to content

Commit

Permalink
intial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
NareshKumar1553 committed Aug 3, 2024
0 parents commit 89f3832
Show file tree
Hide file tree
Showing 1,986 changed files with 649,508 additions and 0 deletions.
483 changes: 483 additions & 0 deletions admin/admin_class.php

Large diffs are not rendered by default.

127 changes: 127 additions & 0 deletions admin/ajax.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?php
ob_start();
$action = $_GET['action'];
include 'admin_class.php';
$crud = new Action();
if($action == 'login'){
$login = $crud->login();
if($login)
echo $login;
}
if($action == 'login2'){
$login = $crud->login2();
if($login)
echo $login;
}
if($action == 'logout'){
$logout = $crud->logout();
if($logout)
echo $logout;
}
if($action == 'logout2'){
$logout = $crud->logout2();
if($logout)
echo $logout;
}

if($action == 'signup'){
$save = $crud->signup();
if($save)
echo $save;
}
if($action == 'save_user'){
$save = $crud->save_user();
if($save)
echo $save;
}
if($action == 'update_user'){
$save = $crud->update_user();
if($save)
echo $save;
}
if($action == 'upload_file'){
$save = $crud->upload_file();
if($save)
echo $save;
// var_dump($_FILES);
}
if($action == 'remove_file'){
$delete = $crud->remove_file();
if($delete)
echo $delete;
}

if($action == 'save_upload'){
$save = $crud->save_upload();
if($save)
echo $save;
}
if($action == 'delete_file'){
$delete = $crud->delete_file();
if($delete)
echo $delete;
}
if($action == 'delete_user'){
$save = $crud->delete_user();
if($save)
echo $save;
}
if($action == 'delete_cart'){
$delete = $crud->delete_cart();
if($delete)
echo $delete;
}
if($action == 'save_category'){
$save = $crud->save_category();
if($save)
echo $save;
}
if($action == 'delete_category'){
$delete = $crud->delete_category();
if($delete)
echo $delete;
}
if($action == 'save_product'){
$save = $crud->save_product();
if($save)
echo $save;
}
if($action == 'delete_product'){
$delete = $crud->delete_product();
if($delete)
echo $delete;
}
if($action == "add_to_cart"){
$save = $crud->add_to_cart();
if($save)
echo $save;
}
if($action == "update_cart"){
$save = $crud->update_cart();
if($save)
echo $save;
}
if($action == "get_cart_count"){
$get = $crud->get_cart_count();
if($get)
echo $get;
}

if($action == "save_order"){
$save = $crud->save_order();
if($save)
echo $save;
}
if($action == "update_order"){
$save = $crud->update_order();
if($save)
echo $save;
}

if($action == "delete_order"){
$delsete = $crud->delete_order();
if($delsete)
echo $delsete;
}
ob_end_flush();
?>
80 changes: 80 additions & 0 deletions admin/category_list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php include'db_connect.php' ?>
<div class="col-lg-12">
<div class="card card-outline card-primary">
<div class="card-header">
<div class="card-tools">
<a class="btn btn-block btn-sm btn-default btn-flat border-primary" href="./index.php?page=new_category"><i class="fa fa-plus"></i> Add New</a>
</div>
</div>
<div class="card-body">
<table class="table tabe-hover table-bordered" id="list">
<colgroup>
<col width="10%">
<col width="30%">
<col width="50%">
<col width="10%">
</colgroup>
<thead>
<tr>
<th class="text-center">#</th>
<th>Name</th>
<th>Description</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
$qry = $conn->query("SELECT * FROM categories order by unix_timestamp(date_created) desc ");
while($row= $qry->fetch_assoc()):
$trans = get_html_translation_table(HTML_ENTITIES,ENT_QUOTES);
unset($trans["\""], $trans["<"], $trans[">"], $trans["<h2"]);
$desc = strtr(html_entity_decode($row['description']),$trans);
$desc=str_replace(array("<li>","</li>"), array("",", "), $desc);
?>
<tr>
<th class="text-center"><?php echo $i++ ?></th>
<td><b><?php echo ucwords($row['name']) ?></b></td>
<td><b class="truncate"><?php echo strip_tags($desc) ?></b></td>
<td class="text-center">
<div class="btn-group">
<a href="./index.php?page=edit_category&id=<?php echo $row['id'] ?>" class="btn btn-primary btn-flat">
<i class="fas fa-edit"></i>
</a>
<button type="button" class="btn btn-danger btn-flat delete_category" data-id="<?php echo $row['id'] ?>">
<i class="fas fa-trash"></i>
</button>
</div>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$('#list').dataTable()
$('.delete_category').click(function(){
_conf("Are you sure to delete this category?","delete_category",[$(this).attr('data-id')])
})
})
function delete_category($id){
start_load()
$.ajax({
url:'ajax.php?action=delete_category',
method:'POST',
data:{id:$id},
success:function(resp){
if(resp==1){
alert_toast("Data successfully deleted",'success')
setTimeout(function(){
location.reload()
},1500)

}
}
})
}
</script>
3 changes: 3 additions & 0 deletions admin/db_connect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

$conn= new mysqli('localhost','root','','jewelry_db')or die("Could not connect to mysql".mysqli_error($con));
13 changes: 13 additions & 0 deletions admin/download.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php


$fname=$_GET['f'];
$fx = explode("_", $fname,2);
$name = $fx[1];
$file = ("assets/uploads/".$fname);

header ("Content-Type: ".filetype($file));
header ("Content-Length: ".filesize($file));
header ("Content-Disposition: attachment; filename={$name}");

readfile($file);
8 changes: 8 additions & 0 deletions admin/edit_category.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
include 'db_connect.php';
$qry = $conn->query("SELECT * FROM categories where id = ".$_GET['id'])->fetch_array();
foreach($qry as $k => $v){
$$k = $v;
}
include 'new_category.php';
?>
8 changes: 8 additions & 0 deletions admin/edit_product.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
include 'db_connect.php';
$qry = $conn->query("SELECT * FROM products where id = ".$_GET['id'])->fetch_array();
foreach($qry as $k => $v){
$$k = $v;
}
include 'new_product.php';
?>
8 changes: 8 additions & 0 deletions admin/edit_user.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
include 'db_connect.php';
$qry = $conn->query("SELECT * FROM users where id = ".$_GET['id'])->fetch_array();
foreach($qry as $k => $v){
$$k = $v;
}
include 'new_user.php';
?>
Loading

0 comments on commit 89f3832

Please sign in to comment.