Preview: submit-product.php
Size: 1.81 KB
/home/urbanman/roadkaraja.in/admin/submit-product.php
<?php
error_reporting(0);
@session_start();
include("config.php");
$product=$_POST[product];
$point=$_POST[point];
$qty=$_POST[qty];
$flag = $_REQUEST[flag];
$mode = $_REQUEST[mode];
/***********************************/
$id= $_POST[id];
if($id=="")
{
$query_insert=sprintf("Insert INTO product SET proname='$product',point='%s', qty='%s' ",$point,$qty);
if(!($resi=mysql_query($query_insert))){echo $query_insert.mysql_error(); exit;}
$id=mysql_insert_id();
if($_FILES["pimg"]["name"]!="")
{
$fileload = $_FILES["pimg"]["name"];
$file_ext = explode(".",$fileload);
$myattach="pimg_".$id.".".$file_ext[1];
$destpath=$uploadpath.$myattach;
$file1 = move_uploaded_file($_FILES["pimg"]["tmp_name"],$destpath);
$updatecategory=sprintf("UPDATE product SET pimg ='%s' WHERE id ='%d'", $myattach, $id);
if(!($result = mysql_query($updatecategory))){echo $updatecategory.mysql_error();exit;}
}
header("Location:add-inventory.php?flag=dn");
exit;
}
$id= $_POST[id];
if($id!="")
{
$query_up=sprintf("UPDATE product SET proname='$product',point='%s' WHERE id='%d' ",$point,$id);
if(!($resu=mysql_query($query_up))){echo $query_up.mysql_error(); exit;}
if($_FILES["pimg"]["name"]!="")
{
$fileload = $_FILES["pimg"]["name"];
$file_ext = explode(".",$fileload);
$myattach="pimg_".$id.".".$file_ext[1];
$destpath=$uploadpath.$myattach;
$file1 = move_uploaded_file($_FILES["pimg"]["tmp_name"],$destpath);
$updatecategory=sprintf("UPDATE product SET pimg ='%s' WHERE id ='%d'", $myattach, $id);
if(!($result = mysql_query($updatecategory))){echo $updatecategory.mysql_error();exit;}
}
header("Location:product-list.php?flag=up");
exit;
}
?>
Directory Contents
Dirs: 4 × Files: 78