GIF89a
<?php ob_start(); ini_set('error_reporting', E_STRICT); include("connect.php"); mysqli_set_charset($conn,'utf8'); $cat=str_replace("'","\'",$_POST['cat']); $psr=$_POST['psr']; $subcat=str_replace("'","\'",$_POST['subcat']); $qty=$_POST['qty']; $rprice=$_POST['rprice']; $sprice=$_POST['sprice']; $pcode=$_POST['pcode']; $mff=str_replace("'","\'",$_POST['mff']); $s_charge=$_POST['s_charge']; $prod_cod=$_POST['prod_cod']; $pname=str_replace("'","\'",$_POST['pname']); $desc=str_replace("'","\'",$_POST['desc']); $user_id=$_COOKIE["user_idd"]; $user_type=$_COOKIE["user_typee"]; $uid=rand(1000,9999); $colors=$_POST['colors']; $sizes=$_POST['sizes']; $gst=$_POST['gst']; if($_FILES["image"]["name"]=="") { if($user_type=='1' || $user_type=='2'){ $sql="UPDATE `products` SET `cat_name`='".$cat."',`subcat_name`='".$subcat."',`p_name`='".$pname."',`qty`='".$qty."',`real_price`='".$rprice."',`sale_price`='".$sprice."',`p_code`='".$pcode."',`manufacturer`='".$mff."',`p_desc`='".$desc."',`datee`='".date('Y-m-d')."',`ship_chrg`='".$s_charge."',`cod`='".$prod_cod."',`prod_approval`='1',`user_id`='".$user_id."',`user_type`='".$user_type."',`priority`='0',`p_color`='".$colors."',`p_size`='".$sizes."',`gst`='".$gst."' WHERE `sr`='".$psr."'"; }else{ $sql="UPDATE `products` SET `cat_name`='".$cat."',`subcat_name`='".$subcat."',`p_name`='".$pname."',`qty`='".$qty."',`real_price`='".$rprice."',`sale_price`='".$sprice."',`p_code`='".$pcode."',`manufacturer`='".$mff."',`p_desc`='".$desc."',`datee`='".date('Y-m-d')."',`ship_chrg`='".$s_charge."',`cod`='".$prod_cod."',`prod_approval`='0',`user_id`='".$user_id."',`user_type`='".$user_type."',`priority`='0',`p_color`='".$colors."',`p_size`='".$sizes."',`gst`='".$gst."' WHERE `sr`='".$psr."'"; } $rs=mysqli_query($conn,$sql); if($rs>0) { echo '<script>alert("Product details updated successfully !!");</script>'; echo '<script>window.location.href="addremoveproduct.php";</script>'; // header("Location: cardMe.php?uid=".$uid.""); } else { echo '<script>alert("Unable to update products details");</script>'; echo '<script>window.location.href="addremoveproduct.php";</script>'; } } else { // target directory $target_dir='prod_image/'.$uid.$_FILES["image"]["name"]; // Check if file already exists if (file_exists($target_dir)) { echo '<script>alert("File already exist | try another file");</script>'; echo '<script>window.location.href="addremoveproduct.php";</script>'; } else { $FileType = strtolower(pathinfo($target_dir,PATHINFO_EXTENSION)); if($FileType != "png" && $FileType != "jpg" && $FileType != "jpeg" ) { // file format not supportedonly images allows echo '<script>alert("Invalid image format");</script>'; echo '<script>window.location.href="addremoveproduct.php";</script>'; } else { move_uploaded_file($_FILES["image"]["tmp_name"],$target_dir); // check banner is avil or not if($user_type=='1' || $user_type=='2'){ $sql="UPDATE `products` SET `cat_name`='".$cat."',`subcat_name`='".$subcat."',`p_name`='".$pname."',`qty`='".$qty."',`real_price`='".$rprice."',`sale_price`='".$sprice."',`p_code`='".$pcode."',`manufacturer`='".$mff."',`p_desc`='".$desc."',`image`='".$target_dir."',`datee`='".date('Y-m-d')."',`ship_chrg`='".$s_charge."',`cod`='".$prod_cod."',`prod_approval`='1',`user_id`='".$user_id."',`user_type`='".$user_type."',`priority`='0',`p_color`='".$colors."',`p_size`='".$sizes."',`gst`='".$gst."' WHERE `sr`='".$psr."'"; }else{ $sql="UPDATE `products` SET `cat_name`='".$cat."',`subcat_name`='".$subcat."',`p_name`='".$pname."',`qty`='".$qty."',`real_price`='".$rprice."',`sale_price`='".$sprice."',`p_code`='".$pcode."',`manufacturer`='".$mff."',`p_desc`='".$desc."',`image`='".$target_dir."',`datee`='".date('Y-m-d')."',`ship_chrg`='".$s_charge."',`cod`='".$prod_cod."',`prod_approval`='0',`user_id`='".$user_id."',`user_type`='".$user_type."',`priority`='0',`p_color`='".$colors."',`p_size`='".$sizes."',`gst`='".$gst."' WHERE `sr`='".$psr."'"; } $rs=mysqli_query($conn,$sql); if($rs>0) { echo '<script>alert("Product details updated successfully !!");</script>'; echo '<script>window.location.href="addremoveproduct.php";</script>'; // header("Location: cardMe.php?uid=".$uid.""); } else { echo '<script>alert("Unable to update products details");</script>'; echo '<script>window.location.href="addremoveproduct.php";</script>'; } } } } ?>