file_get_contents
1#@!#!123s
D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
u247928417
/
domains
/
riddi.in
/
public_html
/
admin
/
Filename :
add-single-product-new.php
back
Copy
<?php include ("session/session.php"); error_reporting(0); include ("config/config.php"); if (isset($_REQUEST['save_single_product_1'])) { $search_ava = "SELECT * FROM interface_product WHERE product_code='" . $_POST["sku_code"] . "'"; $ava_res =mysqli_query($conn,$search_ava) or die(mysqli_error()); if ($ava_row = mysqli_fetch_assoc($ava_res)) { echo '<script>alert("SKU Code is alredy exists! Unable to added product please try again!")</script>'; echo "<meta http-equiv='refresh' content='0; url=catalog_product?select_val=$product_setting&select_type=Continue'/>"; } else { $insert_product = "INSERT INTO `interface_product`" . "(`product_code`, `product_name`,`product_weight`,`product_status`, `product_s_desc`, `product_l_desc`) " . "VALUES ('" . strtoupper($_REQUEST['sku_code']) . "'," . "'" . ucwords($_REQUEST['p_name']) . "'," . "'" . $_REQUEST['p_weight'] . "'," . "'" . $_REQUEST['p_status'] . "'," . "'" . $_REQUEST['ps_desc'] . "'," . "'" . $_REQUEST['p_desc'] . "')"; $insert_product_res =mysqli_query($conn,$insert_product) or die(mysqli_error()); $product_last = mysql_insert_id(); $product_price = "INSERT INTO `interface_price` (`product_price`, `product_s_price`, `product_tax_class`, `product_type`, `product_id`) " . "VALUES ('" . $_REQUEST['p_price'] . "','" . $_REQUEST['ps_price'] . "','" . $_REQUEST['tax_class'] . "','" . $_REQUEST['p_type'] . "','" . $product_last . "')"; $insert_price_res =mysqli_query($conn,$product_price) or die(mysqli_error()); $product_last_price = mysql_insert_id(); $product_discount = "INSERT INTO `interface_discount`(`product_discount`, `product_id`)" . " VALUES ('" . $_REQUEST['p_discount'] . "','" . $product_last . "')"; $insert_discount_res =mysqli_query($conn,$product_discount) or die(mysqli_error()); $product_last_discount = mysql_insert_id(); $product_meta = "INSERT INTO `interface_meta`(`meta_title`, `meta_keyword`, `meta_description`, `product_id`) " . "VALUES ('" . $_REQUEST['meta_title'] . "','" . $_REQUEST['meta_key'] . "','" . $_REQUEST['meta_desc'] . "','" . $product_last . "')"; $insert_meta_res =mysqli_query($conn,$product_meta) or die(mysqli_error()); $product_last_meta = mysql_insert_id(); $product_inventory = "INSERT INTO `interface_inventory`(`product_quant`, `product_stock`, `product_id`) " . "VALUES ('" . $_REQUEST['p_quant'] . "','" . $_REQUEST['availabilty'] . "','" . $product_last . "')"; $insert_inventory_res =mysqli_query($conn,$product_inventory) or die(mysqli_error()); $product_last_inventory = mysql_insert_id(); $product_manu = "INSERT INTO `interface_manufactured`(`brand_name`, `country_name`, `product_id`) " . "VALUES ('" . $_REQUEST['brand_name'] . "','" . $_REQUEST['country_name'] . "','" . $product_last . "')"; $insert_manu_res =mysqli_query($conn,$product_manu) or die(mysqli_error()); $product_last_manufactured = mysql_insert_id(); //for images $imagename2 = $_FILES['location_banner']['name']; $path2 = 'upload/'; $tempfile2 = $_FILES['location_banner']['tmp_name']; $size2 = $_FILES['location_banner']['size']; $type2 = $_FILES['location_banner']['type']; $num3 = time(); $filePath2 = $path2 . $num3 . "-" . $imagename2; if ($imagename2 != '') { $img = $filePath2; }if ($imagename2 == '') { $img = ''; } move_uploaded_file($tempfile2, $filePath2); $insertImg = "INSERT INTO `interface_product_images`(`img_1`, `img_2`, `img_3`, `product_id`) VALUES ('" . $img . "','" . $img . "','" . $img . "','" . $product_last . "')"; $queryImg =mysqli_query($conn,$insertImg) or die(mysqli_error()); $product_last_image = mysql_insert_id(); // update or insert menu or sub menu $cat_id = $_REQUEST['super_cat']; $list_cat = sizeof($_REQUEST['super_cat']); for ($cat_i = 0; $cat_i < $list_cat; $cat_i++) { //echo 'record' . $cat_id[$cat_i] . '<br/>'; $InsertMenu = "INSERT INTO `interface_procategories` (`sub_category_id`, `product_id`) " . "VALUES ('" . $cat_id[$cat_i] . "','" . $product_last . "')"; $InsertMenuRes =mysqli_query($conn,$InsertMenu); } $upadte_product = "UPDATE `interface_product` SET " . "`price_id`='" . $product_last_price . "'," . "`meta_id`='" . $product_last_meta . "'," . "`product_thumb_id`='" . $product_last_image . "'," . "`inventory_id`='" . $product_last_inventory . "'," . "`manufactured_id`='" . $product_last_manufactured . "' WHERE `product_id` = '" . $product_last . "'"; $update_product_result =mysqli_query($conn,$upadte_product) or die(mysqli_error()); echo '<script>alert("Product is added successfully.")</script>'; echo "<meta http-equiv='refresh' content='0; url=product'/>"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <?php include './panel-files/head.php'; ?> </head> <body> <?php include './panel-files/header.php'; include './panel-files/menu.php'; ?> <!-- /subnavbar --> <div class="main"> <div class="main-inner"> <div class="container"> <div class="row"> <div class="main"> <div class="main-inner"> <div class="container"> <div class="row"> <div class="span12"> <div class="widget widget-nopad"> <div class="widget-header"> <i class="icon-list-alt"></i> <h3> Product Information</h3> </div> <div class="widget-content"> <div class="widget big-stats-container"> <div class="widget-content"> <form class="form-horizontal add-single-product" action="" method="post"> <table class="table table-striped table-bordered"> <thead> <tr> <th> General Information </th> <th> Price Information </th> <th> Meta Information </th> <th> Inventory </th> </tr> </thead> <tbody> <tr> <td> <input type="text" class="span3 disabled" name="sku_code" placeholder="Enter Product SKU Code"/> <br/><br/> <input type="text" class="span3 disabled" name="p_name" placeholder="Enter Product Name"/> <br/><br/> <span class="btn btn-default btn-file"> Browse <input type="file" name="location_banner" id="photoimg" /> </span> <br/><br/> <select id="p_status" name="p_status"> <option value=""> Product Status </option> <option value="0"> Disable </option> <option value="1"> Enable </option> </select> <br/><br/> <textarea class="span3 disabled" name="ps_desc"/> </textarea> <br/><br/> </td> <td style="vertical-align: top;"> <input type="text" class="span3 disabled" name="sku_code" placeholder="Enter Product SKU Code"/> <br/><br/> <input type="text" class="span3 disabled" name="sku_code" placeholder="Enter Product SKU Code"/> <br/><br/> <input type="text" class="span3 disabled" name="sku_code" placeholder="Enter Product SKU Code"/> <br/><br/> <input type="text" class="span3 disabled" name="sku_code" placeholder="Enter Product SKU Code"/> <br/><br/> <input type="text" class="span3 disabled" name="sku_code" placeholder="Enter Product SKU Code"/> <br/><br/> </td> <td style="vertical-align: top;"> <input type="text" class="span3 disabled" name="sku_code" placeholder="Enter Product SKU Code"/> <br/><br/> <input type="text" class="span3 disabled" name="sku_code" placeholder="Enter Product SKU Code"/> <br/><br/> <input type="text" class="span3 disabled" name="sku_code" placeholder="Enter Product SKU Code"/> <br/><br/> <input type="text" class="span3 disabled" name="sku_code" placeholder="Enter Product SKU Code"/> <br/><br/> <input type="text" class="span3 disabled" name="sku_code" placeholder="Enter Product SKU Code"/> <br/><br/> </td> <td style="vertical-align: top;"> <input class="span3 disabled" type="text" name="p_quant" placeholder="Product Quantity"> <br/><br/> <select id="availabilty" name="availabilty"> <option value=""> Select </option> <option value="0">Out of Stock</option> <option value="1">In Stock</option> </select> </td> </tr> </tbody> </table> <div class="control-group"> <div class="controls"> </div> <!-- /controls --> </div> <!-- /control-group --> <div class="form-actions"> <input type="submit" name="add_product" value="Add Product"> </div> <!-- /form-actions --> </form> </div> </div> </div> </div> </div> </div> </div> <!-- /container --> </div> <!-- /main-inner --> </div> </div> </div> <!-- /container --> </div> <!-- /main-inner --> </div> <?php include('panel-files/footer.php');?> <!-- /footer-inner --> </div> </body> </html>