[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: add_packages.php
<?php include 'header.php' ; $show=new Oops($db); ?> <div id="page-wrapper"> <div class="main-page"> <div class="row"> <div class="form-grids row widget-shadow"> <div class="form-title"> <h4>Add 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']."'>".$row['category']."</option>"; } } ?> </select> </div> <div class="col-md-5"> <label>Package Name</label> <input type="text" name="pc_name" class="form-control" required /> </div> <div class="col-md-2"> <label>Max No of Pax</label> <input type="number" name="pax" class="form-control" required /> </div> <div class="col-md-2"> <label>Price</label> <input type="text" name="price" class="form-control" required /> </div> <div class="col-md-2"> <label>Room No</label> <input type="text" name="room_no" class="form-control" required /> </div> <div class="col-md-3"> <input type="hidden" id="getid1" value="1"> <div class='tr_input2' id="tab2" style="border:none !important;padding-bottom:5px"> <table> <tr> <th>Amenities</th></tr> <tr> <td> <select name="amen[]" id="testcode_1" 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 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<br> <span>Please Upload of resolution of 600px * 800px for best fit.(100kb)</span></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-12"> <label>Package Details</label> <textarea name="details" class="form-control"></textarea> </div> <div class="col-md-12"> <label>Specialities</label> <textarea name="spcl" class="form-control" ></textarea> </div> <div class="col-md-12"> <label>Note</label> <textarea name="note" class="form-control"></textarea> </div> <input type="submit" name="sub" value="Submit" class="btn btn-info btn-fill pull-right"> <div class="clearfix"></div> </form> <?php if(isset($_POST['sub'])){ $table='packages'; $uid=$show->getid('ids','PCK'); foreach($_POST['amen'] as $key=>$value){ $amen[]=$value; } $ameni=implode(':',$amen); 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=uniqid().$pic; $data1 = array( 'user_id'=> $_SESSION['login_user'], 'image' => $img1, 'package_id'=> $uid, ); // print_r($data1); 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>"; } } } }} // print_r($ameni); $data=array( 'user_id'=> $_SESSION['login_user'], 'package_name'=>$_POST['pc_name'], 'price'=>$_POST['price'], 'details'=>$_POST['details'], 'speciality'=>$_POST['spcl'], 'note'=>$_POST['note'], 'date'=>date('Y-m-d'), 'amenities'=> $ameni, 'package_id'=> $uid, 'pax'=>$_POST['pax'], 'category'=>$_POST['category'], 'room_no'=>$_POST['room_no'], ); // print_r($data); $r=$show->insert($table,$data); if($r){ echo "<script>sweetAlert('Ok','Package has been added','success');window.location.href='all_package.php';</script>"; } } ?> </div> </div> </div> </div> </div> <script> //add pictures $(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; // New index 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='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><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> </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.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