this is my productprocess.php
<?php
session_start();
require_once("../Classes/Products.php");
require_once("../Classes/Products.php");
require_once("../Classes/User.php");
$id=$_GET['id'];
$productid=$_GET['id'];
$userid=$_SESSION["user_id"];
$productid = $_SESSION["product_id"];
$availability = $_POST["availability"];
$title = $_POST["title"];
$sku = $_POST["sku"];
$weight = $_POST["weight"];
$per_box = $_POST["per_box"];
$product_image=$_FILES['product_image']['name'];
$product_image_source = $_FILES['product_image']['tmp_name'];
$description = $_POST["description"];
$xmp_campaign_id = $_POST["xmp_campaign_id"];
$xmp_final_document = $_POST["xmp_final_document"];
$xmp_proof_document = $_POST["xmp_proof_document"];
$xmp_doc_image = $_POST["xmp_doc_image"];
$price = $_POST['price'];
$qty=$_POST['qty'];
if ($id <=0 ) //New user
{//0000000000000000000000000000
$message="";
if (trim($title) == "" ){ $message = $message . "* Title must not be blank. <br> "; }
if (trim($sku) == "" ){ $message = $message . "* sku must not be blank. <br> "; }
if (trim($weight) == "" ){ $message = $message . "* weight must not be blank. <br>" ;}
if (trim($per_box) == "" ){ $message = $message ."* per_box must not be blank. <br> "; }
if (trim($description) == "" ){ $message = $message . "* description must not be blank <br>";}
if(trim($xmp_campaign_id) == "") { $message = $message . "* xmp_campaign_id must not be blank <br>"; }
if(trim($xmp_final_document) == "") { $messasge = $message . "* xmp_final_document must not be blank <br>"; }
if(trim($xmp_proof_document) == "") { $message = $message . "* xmp_proof_document must not be blank <br>"; }
if(trim($qty) == "") { $message = $message . "* qty must not be blank <br>"; }
if(trim($price) == "") { $message = $message . "* price must not be blank <br>"; }
if (strlen($message)<=0)
{
$productclass = new Products;
$login_timestamp=$productclass->getloginhash();
$file_upload="true";
$file_up_size=$_FILES['product_image'][size];
if ($_FILES[product_image][size]>250000){$msg=$msg."Your uploaded file size is more than 250KB so please reduce the file size and then upload. Visit the help page to know how to reduce the file size.<BR>";
$file_upload="false";}
if (!($_FILES[product_image][type] =="image/jpeg" OR $_FILES[product_image][type] =="image/gif" OR $_FILES[product_image][type] =="image/pjpeg")){$msg=$msg."Your uploaded file must be of JPG or GIF. Other file types are not allowed<BR>";
$file_upload="false";}
$file_name=$_FILES[product_image][name];
$add="../upload/$file_name"; // the path with the file name where the file will be stored, upload is the directory name.
$add1=$_SERVER['DOCUMENT_ROOT']."/polkmarcom/upload/$file_name";
if($file_upload=="true"){
if(move_uploaded_file ($_FILES[product_image][tmp_name], $add)){
}else{echo "Failed to upload file Contact Site admin to fix the problem";}
}else{echo $msg;}
$_SESSION['site_id1'] = 4;
$query = "'" . time() .
"','".$_SESSION['site_id1'] ."','".$sku."','".$availability."','" .$xmp_campaign_id.
"','" .$xmp_final_document."','". $xmp_proof_document."','".$title .
"','" .
$weight.
"','" .
$description .
"','" .
$product_image."','".$add1."','".$xmp_doc_image."','".$per_box."'";
$Local_Userclass2=new Products;
if ($Local_Userclass2->saveproduct(1,$query,'') ==1) { $_SESSION["curr_error"]= "";
$message="";
$result= mysql_query("select max(id) from products");
$row = mysql_fetch_array($result);
$mid= $row[0];
$priceqry="select max(id)+1 from prices";
$resultprice= mysql_query($priceqry);
$rowprice = mysql_fetch_array($resultprice);
$priceid= $rowprice[0];
$date_added=time();
$string = "insert into prices(id,date_added,users_id,products_id,quantity,price) values ('".$priceid."','".$date_added."','".$userid."','".$mid."','".$qty."','".$price."')";
$res=mysql_query($string);
print "<script>";
print "window.location.href='../forms/addproducts.php?id=0&succ_msg1=insert'";
print "</script>";
}
}
else
{
$_SESSION["curr_error"]= "The Following errors were sent back with your submission.".
" <br> " .
$message . "<br>" .
"Please verify that the following is corrected and try again.";
session_write_close();
header("location: ../Forms/addproducts.php?id=0");
}
}
else
{
$firstname=$_SESSION['First_name'];
$lastname=$_SESSION['Last_name'];
$queryuser="select id from users where firstname='".$firstname."' and lastname='".$lastname."'";
$res=mysql_query($queryuser);
$row=mysql_fetch_row($res);
$userid=$row['0'];
$availability=$_POST['availability'];
$title=$_POST['title'];
$sku=$_POST['sku'];
$weight=$_POST['weight'];
$per_box=$_POST['per_box'];
$description=$_POST['description'];
$id1=$_POST['id'];
$priceqty=$_POST['qty'];
$priceprice=$_POST['price'];
$xmpcampaignid=$_POST['xmp_campaign_id'];
$xmpfinaldoc=$_POST['xmp_final_document'];
$proofdoc=$_POST['xmp_proof_document'];
$xmpdocimage=$_POST['xmp_doc_image']; //die;
$product_image=$_FILES['product_image']['name'];
$product_image_source = $_FILES['product_image']['tmp_name'];
$updquery = "update products set date_modified='" . time() .
"',sku='" . trim($sku) .
"',availability='" .
trim($availability).
"',weight=" .
trim($weight).
",per_box='" .
$per_box .
"',description='" .
$description ."',image_name='". $product_image."',image_source='".$product_image_source."',xmp_campaign_id=".$xmpcampaignid.",xmp_final_document=".$xmpfinaldoc.",xmp_proof_document=".$proofdoc.",xmp_doc_image='".$xmpdocimage."' where id=" . $id;
$Local_Productsclass2= new Products;
$temp=$Local_Productsclass2->saveproduct(2,$updquery,'');
if ($temp==1)
{
header("location: ../Forms/productslist.php?pid=1&succ_msg2=update");
}
$_SESSION["curr_error"]= "";
$message="";
exit();
}
?>
and this is my products class
<?php
require_once("../Database/functions.php");
class Products
{ // <><><><><><><><><><><><><><><><><><><><><><><><> Class Start
function getloginhash()
{
return md5(time());
}
function time2date( $timestamp )
{
$date = @date( "m-d-Y", $timestamp );
return $date;
}
function saveproduct($usermode,$savecolumns,$wherecondition)
{
if ($usermode==1)
{
$maxid=getmax("products","id");
$maxidprice = getmax("prices","id");
return Execute_query( "insert into products(id,date_added,site_id,sku,availability,xmp_campaign_id,xmp_final_document,xmp_proof_document,title,weight,description,image_name,image_source,xmp_doc_image,per_box) values ( ". $maxid .",". $savecolumns .")");
}
if ($usermode==2)
{
return Execute_query($savecolumns) ;
}
}
function getProductname($productid)
{
if($productid !=""){
$qry="SELECT * from Products where site_id=4 and id=".$productid;
$res=mysql_query($qry);
$row=mysql_fetch_row($res);
$id=$row['0'];
$date_added=$row['1'];
$date_modified=$row['2'];
$site_id=$row['3'];
$sku=$row['4'];
$availability=$row['5'];
$modifiedby=$row['6'];
$epace_item_id = $row['7'];
$xmp_campaign_id=$row['8'];
$xmp_final_document = $row['9'];
$xmp_proof_document= $row['10'];
$title=$row['11'];
$weight=$row['12'];
$description=$row['13'];
$image_name=$row['14'];
$image_source=$row['15'];
$xmp_doc_image=$row['16'];
$per_box=$row['17'];
$category_id=$row['18'];
$pricequery="select quantity,price from prices where products_id=".$productid;
$res_price=mysql_query($pricequery);
$row_price=mysql_fetch_row($res_price);
$pricequantity=$row_price['0'];
$priceprice=$row_price['1'];
$message=$id." ".$date_added." ".$date_modified." ".$site_id." ".$sku." ".$availability." ".$modifiedby." ".$epace_item_id." ".$xmp_campaign_id." ".$xmp_final_document." ".$xmp_proof_document." ".$title." ".$weight." ".$description." ".$image_name." ".$image_source." ".$xmp_doc_image." ".$per_box." ".$category_id;
return $message;
}
}
function modifyuser($userid)
{
$qry="SELECT firstname,lastname,email,authlevel from Users where site_id=8 and id=".$userid;
$res=mysql_query($qry);
$row=mysql_fetch_row($res);
$firstname=$row['0'];
$lastname=$row['1'];
$email=$row['2'];
$authlevel=$row['3'];
$message=$firstname." ".$lastname." ".$email." ".$authlevel;
return $message;
}
}// <><><><><><><><><><><><><><><><><><><><><><><><> Class End
?>
please solve my problem
thanks in advance