[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: edit-product-services.php
<?php include('header.php');$cid=base64_decode($_REQUEST['cid']); ?> <!-- USER --> <div class="inner-banner"> <img src="images/user-bg.jpg" alt="banner"> </div> <script> //add pictures $(document).ready(function(){ // Add more $('#addmore').click(function(){ // alert('dd'); // Get last id var lastname_id = $('.tr_input 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_input'><div class='form-left-to-w3l ' id='b_name'><input type='text' id='testcode_"+index+"' placeholder='Product / services name' name='service_title_add[]'><input type='file' id='myFile' name='service_img_add[]' ><a href='javascript:void(0);' id='remove_field' class='remCF btn btn-info' >-</a></div></div>"; // Append data $('#tab').append(html); }); $("#tab").on('click','.remCF',function(){ $(this).parent().parent().remove(); var lastname_id = document.getElementById('getid1').value; // New index var index = lastname_id - 1; // Create row with input elements document.getElementById('getid1').value=index; }); }); //gallery $(document).ready(function(){ // Add more $('#addmore2').click(function(){ // alert('dd'); // Get last id var lastname_id = $('.tr_input1 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_input1'><div class='form-left-to-w3l ' id='b_name'><input type='file' id='myfile_"+index+"' name='myFile[]'><a href='javascript:void(0);' id='remove_field1' class='remCF btn btn-info' >-</a></div></div>"; // Append data $('#tab1').append(html); }); $("#tab1").on('click','.remCF',function(){ $(this).parent().parent().remove(); var lastname_id = document.getElementById('getid').value; // New index var index = lastname_id - 1; // Create row with input elements document.getElementById('getid').value=index; }); }); </script> <!-- Social Media Links --> <div class="company-details"> <div class="container"> <h1>Update Products & Gallery</h1> <br> <div class="theme-box aos-init aos-animate" data-aos="fade-down" style="transition:all 1600ms ease-in-out;text-align: center;display: block;"> <form method="post" action="" enctype="multipart/form-data"> <h2>Services & Product <span>(Upload images with in 250 KB each image)</span></h2> <br> <?php $count=1; $sr='service'; $stmt =$show->readwithdata('service','card_id',$cid); $num = $stmt->rowCount(); while ($row1 = $stmt->fetch(PDO::FETCH_ASSOC)){ extract($row1); $id=$row1['id']; ?> <div class="form-left-to-w3l " id="b_name"> <label>Product / services name</label> <input type="text" placeholder="Product / services name" value="<?=$row1['service_title']?>" name="service_title[]" id="paytm_number"> <?php if ($row1['service_img'] !=''){ ?> <img src="cards/documents/<?=$row1['service_img']?>" width="80px"; height="90px"; > <input type="file" name="service_img[]" id="paytm_img" value="cards/documents/<?=$row1['service_img']?>" onchange="return fileValidation('logo')" > <input type="hidden" name="id[]" value="<?=$row1['id']?>"> <input type="hidden" name="img_ser[]" value="<?=$row1['service_img']?>"> <a href="delete.php?id=<?=$id?>&table=<?=$sr?>&url=<?=$_SERVER['REQUEST_URI']?>" class="btn btn-xs btn-danger" value=''>Delete</a> <?php }else{?> <input type="file" name="service_img[]" id="logo1" onchange="return fileValidation('logo1')" > <input type="hidden" name="id[]" value="<?=$row1['id']?>"> <input type="hidden" name="img_ser[]" value="<?=$row1['service_img']?>"> <a href="delete.php?id=<?=$id?>&table=<?=$sr?>&url=<?=$_SERVER['REQUEST_URI']?>" class="btn btn-xs btn-danger" value=''>Delete</a> <?php }?> </div> <?php ++$count;} $run_loop=5-$count; ?> <input type="hidden" id="getid1" value="1"> <div class='tr_input' id="tab" style="border:none !important;"> <div class="form-left-to-w3l " id="b_name"> <label>Product / services name</label> <input type="text" placeholder="Product / services name" id="testcode_1" value="<?=$row1['service_title']?>" name="service_title_add[]" id="paytm_number"> <input type="file" name="service_img_add[]" onchange="return fileValidation('service_img_add')" > </div> <input type="button" class="btn btn-info" value='+' id="addmore"> </div> <h2>Services Image Gallery <span>( upload unlimited images )</span></h2> <br> <?php $count1=1; $sr='gallery'; $stmt =$show->readwithdata('gallery','card_id',$cid); $num = $stmt->rowCount(); while ($row1 = $stmt->fetch(PDO::FETCH_ASSOC)){ extract($row1); $id=$row1['id']; ?> <div class="form-left-to-w3l " id="b_name"> <label> Image</label> <input type="hidden" name="gal_id[]" value="<?=$row1['id']?>"> <input type="hidden" name="gal_img[]" value="<?=$row1['img']?>"> <img src="cards/documents/<?=$row1['img']?>" width="80px"; height="90px"; > <a href="delete.php?id=<?=$id?>&table=<?=$sr?>&url=<?=$_SERVER['REQUEST_URI']?>" class="btn btn-xs btn-danger" value=''>Delete</a> </div> <?php ++$count1; } $run_loop1=5-$count1; ?> <input type="hidden" id="getid" value="1"> <div class='tr_input1' id="tab1" style="border:none !important;"> <div class="form-left-to-w3l " id="b_name"> <input type="file" name="myFile[]" id="myfile_1" onchange="return fileValidation('myFile')" > </div> <input type="button" class="btn btn-info" value='+' id="addmore2"> </div> <div class="form-sub-acc"> <div class="form-sub"> <input type="submit" class="" name="sub" id="sub" value="Submit"> <a href="user.php" class="btn btn-success">Skip</a> </div> </div> </form> <?php if(isset($_POST['sub'])){ //update service tab foreach($_POST['service_title'] as $key=>$service){ if($service!=NULL){ if(file_exists($_FILES['service_img']['tmp_name'][$key]) || is_uploaded_file($_FILES['service_img']['tmp_name'][$key])) { $img=$show->imageEdit($_FILES['service_img']['name'][$key]); move_uploaded_file($_FILES['service_img']['tmp_name'][$key],"cards/documents/".$img); }else{ $img=$_POST['img_ser'][$key];} $id=$_POST['id'][$key]; $update="update service set service_img='".$img."',service_title='".htmlentities(strip_tags($service))."' where id=".$id.""; // echo $update; $r1=$con->prepare($update); $r1->execute(); } } //update service tab //insert service tab foreach($_POST['service_title_add'] as $key=>$service){ if($service!=NULL){ if(file_exists($_FILES['service_img_add']['tmp_name'][$key]) || is_uploaded_file($_FILES['service_img_add']['tmp_name'][$key])) { $img=$show->imageEdit($_FILES['service_img_add']['name'][$key]); move_uploaded_file($_FILES['service_img_add']['tmp_name'][$key],"cards/documents/".$img); }else{ $img='';} $data=array( 'client_id'=>$_SESSION['login_id'], 'service_title'=>htmlentities(strip_tags($service)), 'service_img'=>$img, 'date'=>date('Y-m-d'), 'card_id'=>$cid ); $r2=$show->insert('service',$data); } } //insert service tab //insert gallery tab foreach($_FILES['myFile']['name'] as $key=>$gallery){ // echo $_FILES['myFile']['name'][$key]; if($gallery!=NULL){ if(file_exists($_FILES['myFile']['tmp_name'][$key]) || is_uploaded_file($_FILES['myFile']['tmp_name'][$key])) { $img=$show->imageEdit($_FILES['myFile']['name'][$key]); move_uploaded_file($_FILES['myFile']['tmp_name'][$key],"cards/documents/".$img); }else{ $img='';} $data=array( 'client_id'=>$_SESSION['login_id'], 'img'=>$img, 'date'=>date('Y-m-d'), 'card_id'=>$cid ); // print_r($data); $r4=$show->insert('gallery',$data); } } //insert gallery tab if($r1 || $r2 || $r3 || $r4){ echo '<script> setTimeout(function() { swal({ title: "Thank You ", text: " Service details updated.", type: "success" }, function() { window.location = "user.php"; }); }, 1000); </script>'; } }?> </div> </div> </div> <?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.57 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