[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: edit_package.php
<?php include 'header.php' ; $update=new Oops($db);$show1=new Oops($db); ?> <?php $sr='packages'; $stmt =$update->readwithdata($sr,'id',$_REQUEST['id']); $num = $stmt->rowCount(); if($num>0){ $count=1; while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ extract($row); $id=$row['id']; $p_name=$row['package_name']; $price=$row['price']; $amen=explode(':',$row['amenities']); $details=$row['details']; $speciality =$row['speciality']; $note =$row['note']; $amenity=$row['amenities']; $user_id=$row['user_id']; $pax=$row['pax']; $category=$row['category']; $room_no=$row['room_no']; } }?> <div id="page-wrapper"> <div class="main-page"> <div class="row"> <div class="form-grids row widget-shadow"> <div class="form-title"> <h4>Edit Package :</h4> </div> <div class="form-body"> <form method="post" enctype="multipart/form-data"> <div class="col-md-2"> <label>Category</label> <select name="category" id="" class="form-control"> <option value="">Category</option> <?php $table='hotel_category'; $stmt=$show->readAll($table); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ echo "<option value='".$row['category']."'"; if($category==$row['category']) echo "selected"; echo">".$row['category']."</option>"; } } ?> </select> </div> <div class="col-md-5"> <label>Package Name</label> <input type="text" name="package_name" value="<?=$p_name?>" class="form-control" required /> <input type="hidden" name="pid" value="<?=$_REQUEST['id']?>"/> </div> <div class="col-md-2"> <label>Max No of Pax</label> <input type="number" name="pax" class="form-control" value="<?=$pax?>" required /> </div> <div class="col-md-2"> <label>Price</label> <input type="text" name="price" value="<?=$price?>" class="form-control" required /> </div> <div class="col-md-2"> <label>Room No</label> <input type="text" name="room_no" value="<?=$room_no?>" class="form-control" required /> </div> <div class="col-md-4"> <table class="table table-hover table-striped"> <thead> <th>Amenities</th> <th>Delete</th> </thead> <tbody> <?php foreach($amen as $key=>$val){?> <tr> <td><?=$val?></td> <td><a href="delete_amen.php?amn=<?=$amenity?>&id=<?=$key?>&p_id=<?=$id?>&url=<?=$_SERVER['REQUEST_URI']?>" class="label label-danger" onclick="return send();">Delete</a></td> </tr> <?php } ?> </tbody> </table> </div> <div class="col-md-4"> <input type="hidden" id="getid1" value="1"> <div class="form-group"> <div class='tr_input2' id="tab2" style="border:none !important;padding-bottom:5px"> <table> <tr> <th>Amenities</th></tr> <tr> <td> <select name="amen[]" class="form-control"> <option value="">Amenities</option> <?php $table='hotel_amenity'; $stmt=$show->readAll($table); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ echo "<option value='".$row['amenity']."'>".$row['amenity']."</option>"; } } ?> </select></td> <td><input type="button" class="btn btn-info" value='+' id="addmore2"></td> </tr> </table> </div> </div> </div> <div class="col-md-6"> <table class="table table-hover table-striped"> <thead> <th>Pictures</th> <th>Edit/Delete</th> </thead> <tbody> <?php $sr='package_imgs'; $stmt1 =$show->readwithdata($sr,'package_id',$_REQUEST['pid']); $num1 = $stmt1->rowCount(); if($num1>0){ while ($row1= $stmt1->fetch(PDO::FETCH_ASSOC)){ extract($row1); ?> <tr> <td><img src="<?=$pic_img?>/<?=$row1['image']?>" width="100"></td> <td> <a href="editPic_pack.php?id=<?=$row1['id']?>&pic=<?=$row1['image']?>&url=<?=$_SERVER['REQUEST_URI']?>" class="label label-success" rel="facebox">Edit</a> <a href="delete.php?id=<?=$row1['id']?>&table=<?=$sr?>&url=<?=$_SERVER['REQUEST_URI']?>" class="label label-danger" onclick="return send();">Delete</a></td> </tr> <?php } }else{ echo "";} ?> </tbody> </table> </div> <div class="col-md-6"> <input type="hidden" id="getid" value="1"> <div class="col-md-2"><label>Add Pictures</label></div> <div class='tr_input' id="tab" style="border:none !important;"> <div class="col-md-2"> <input type="file" id="testcode_1" name="file[]"> <input type="button" class="btn btn-info" value='+' id="addmore"> </div> </div> </div> <div class="col-md-12"> <label>Package Details</label> <textarea name="details" class="form-control" required><?=$details?></textarea> </div> <div class="col-md-12"> <label>Specialities</label> <textarea name="spcl" class="form-control" ><?=$speciality?></textarea> </div> <div class="col-md-12"> <label>Note</label> <textarea name="note" class="form-control"><?=$note?></textarea> </div> <input type="submit" name="sub" value="Submit" class="btn btn-info btn-fill pull-right"> <div class="clearfix"></div> </form> </div> <?php if(isset($_POST['sub'])){ foreach($_POST['amen'] as $key=>$value){ $amenvalue[]=$value; } $ameni=implode(':',$amenvalue); if($ameni==''){ $value_amenity=$amenity; }else $value_amenity=$amenity.":".$ameni; //echo $value_amenity; //echo $value_amenity; $allowed = ["package_name","price","speciality","note","details","pax","room_no","category"]; $params = []; $setStr = ""; foreach ($allowed as $key) { if (isset($_POST[$key]) && $key != "id") { $setStr .= "`$key` = :$key,"; $params[$key] = htmlspecialchars(strip_tags($_POST[$key])); } } //$setStr = rtrim($setStr, ","); $setStr .= "`amenities` = :amenities"; $params['id'] =$_POST['pid']; $params['amenities'] =$value_amenity; $show1->table ='packages'; $show1->cols =$setStr; $show1->id_name ='id'; $show1->params =$params; //print_r($params); if(!file_exists($_FILES['file']['tmp_name']) || !is_uploaded_file($_FILES['file']['tmp_name'])) { if(isset($_FILES['file'])){ foreach($_FILES['file']['tmp_name'] as $key=>$value){ $pic=$_FILES['file']['name'][$key]; $img1=date('dmY').$pic; $data1 = array( 'user_id' => $user_id, 'image' => $img1, 'package_id'=>$_POST['pid'] ); if(move_uploaded_file($_FILES['file']['tmp_name'][$key],"../product_img/".$img1)){ if($show->insert('package_imgs',$data1)){ echo "<script>sweetAlert('OK','Thank you for entering images','success');</script>"; } } } } } if($show1->update_all()){ echo "<script>sweetAlert('Ok', 'Proceed to next page','success');window.location.href='".$_SERVER['REQUEST_URI']."'</script>"; }else{ echo "<script>alert('Something went wrong');</script>"; } } ?> </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'><div class='col-md-2'><input type='file' id='testcode_"+index+"' name='file[]'><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('getid').value; var index = lastname_id - 1; // Create row with input elements document.getElementById('getid').value=index; }); }); //amenity $(document).ready(function(){ // Add more $('#addmore2').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('getid1').value=index; // Create row with input elements var html = "<div class='tr_input2' style='padding-bottom: 5px;'><table><tr><td><select name='amen[]' id='testcode_"+index+"' class='form-control'><option value=''>Amenities</option><?php $table='amenity';$stmt=$show->readAll($table);$num=$stmt->rowCount();if($num>0){while($row=$stmt->fetch(PDO::FETCH_ASSOC)){echo "<option value='".$row['amenity']."'>".$row['amenity']."</option>";}} ?></select></td><td><a href='javascript:void(0);' id='remove_field' class='remCF1 btn btn-info' >-</a></td></tr></table></div>"; // Append data $('#tab2').append(html); }); $("#tab2").on('click','.remCF1',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; }); }); </script> <?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.54 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