[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: add_items.php
<?php include('header.php'); ?> <style type="text/css"> #fli,#fli1 { width: 79%; height: 42px; } #display { position:absolute; width:303; margin-left:0; margin-top:0; padding:2px; display:none; border-top:0px; overflow:auto; border:1px #CCC solid; background-color: white; z-index:1000; } .show,.show1 { padding:7px; border-bottom:1px #999 dashed; font-size:13px; } .show:hover,.show1:hover { color:#000; cursor:pointer; } .widget{ overflow:visible !important; } </style> <script> function fill(Value,Value1,Value2) { $('#name').val(Value1); $('#maker_id').val(Value); $('#phone').val(Value2); $('#display').hide(); //window.location.href='product1.php?cate='+Value+''; } $(document).ready(function(){ $("#name").keyup(function() { var search = $('#name').val(); //alert(search); if(search=="") { $("#display").html(""); } else { $.ajax({ type: "POST", url: "ajax_check.php", data: "search="+ search , success: function(html){ $("#display").html(html).show(); } }); } }); }); </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">Add Items</div> </div> <form method="post" id="exampleValidation" data-toggle="validator" enctype="multipart/form-data" > <div class="card-body"> <div class="form-group "> <div class="col-lg-12 col-md-12 col-sm-12"> <div class="table-responsive"> <table id="basic-datatables" class="display table table-striped table-hover"> <thead> <tr> <th>Category</th> <th>Name</th> <th>Price</th> <th>Image</th> <th>Add</th> </tr> </thead> <tbody class='tr_input' id="tab" style="border:none !important;"> <tr> <td> <div class="select2-input"> <select name="category[]" class="form-control" > <option value="">Category</option> <?php $sr='maker_category'; $stmt =$show->readwithdata($sr,'maker_id',$_SESSION['login_id']); $num = $stmt->rowCount(); if($num>0){ $count=1; while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ extract($row); ?> <option value="<?=$row['category']?>"><?=$row['category']?></option> <?php } } ?> </select> </div> </td> <td><input type='text' class="form-control" placeholder="eg:Fortune Oil" id='dtestcode_1' name='name[]'> </td> <td><input type="text" name="price[]" size="5" class="form-control" placeholder="eg:200" id="dtestcode_1" pattern="[0-9]+" title="Number only"> </td> <td> <input type="file" class="btn btn-icon btn-secondary btn-round btn-xs" id="uploadImg" name="uploadImg[]" accept="image/*" required > </td> <td><input type="button" class="btn btn-info" value="+" id="addmore"></td> </tr> </tbody> </table> </div> </div> </div> <div class="seperator-solid"></div> </div> <div class="card-action"> <div class="row"> <div class="col-md-12"> <input class="btn btn-success" type="submit" name="sub" value="Submit"> <button class="btn btn-danger">Cancel</button> </div> </div> </div> </form> </div> </div> <?php if(isset($_POST['sub'])){ // $status='Active'; foreach($_POST['name'] as $key=>$value){ $menu_id=$show->getid('ids','ITM'); if(file_exists($_FILES['uploadImg']['tmp_name'][$key]) || is_uploaded_file($_FILES['uploadImg']['tmp_name'][$key])) { $img=$show->imageEdit($_FILES['uploadImg']['name'][$key]); move_uploaded_file($_FILES['uploadImg']['tmp_name'][$key],"../product_img/".$img); }else{ $img='';} $data = array( 'maker_id' => $_SESSION['login_id'], 'menu_id' => $menu_id, 'maker_name' => $_SESSION['login_user'], 'phone' => htmlentities(strip_tags($_POST['phone'])), 'type' => htmlentities(strip_tags($_POST['type'][$key])), 'category' => htmlentities(strip_tags($_POST['category'][$key])), 'name' => htmlentities(strip_tags($_POST['name'][$key])), 'price'=>htmlentities(strip_tags($_POST['price'][$key])), 'updated_by'=>$_SESSION['main_category'], 'status'=>'ACTIVE', 'image'=>$img ); //print_r($data); if($show->insert('menu_items',$data)){ echo '<script> setTimeout(function() { swal({ title: "Thanks!", text: "Menu item has been uploaded", type: "success" }, function() { window.location = "'.$_SERVER['REQUEST_URI'].'"; }); }, 1000); </script>'; //echo "<script>swal('Thank you for Registration.');window.location.href='".$_SERVER['request_uri']."';</script>"; } } }?> <script type="text/javascript"> $(document).ready(function(){ // Add more $('#addmore').click(function(){ // Get last id var lastname_id = $('.tr_input input[type=text]:nth-child(1)').last().attr('id'); var split_id = lastname_id.split('_'); // alert('ss'); // New index var index = Number(split_id[1]) + 1; // Create row with input elements var html = "<tr> <td><div class='select2-input'><select name='category[]' class='form-control' ><option value=''>Category</option><?php $sr='maker_category'; $stmt=$show->readwithdata('maker_category','maker_id',$_SESSION['login_id']);while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ extract($row);?><option value='<?=$row['category']?>'><?=$row['category']?></option><?php } ?></select></div></td> <td><input type='text' class='form-control' placeholder='eg:Fortune Oil' id='testcode_"+index+"' name='name[]'/></td> <td><input type='text' pattern='[0-9]+' title='Number only' class='form-control' placeholder='eg:200' id='testcode_"+index+"' size='5' name='price[]'/></td> <td><input type='file' class='btn btn-icon btn-secondary btn-round btn-xs' id='uploadImg"+index+"' name='uploadImg[]' accept='image/*' required > </td><td><a href='javascript:void(0);' id='remove_field' class='btn btn-danger remCF' >-</a></td></tr>"; // Append data $('#tab').append(html); }); $("#tab").on('click','.remCF',function(){ $(this).parent().parent().remove(); }); }); </script> </div></div> </div> </div> <!--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: 677.51 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