$product="active"; $caller1="open"; $prod_add="active"; require_once '../template/superadmin/action_connection.php' ; include("../settings/adminsession.php"); session_start(); $id=$_REQUEST['id']; $Query_last_data = "SELECT * from shop_product where product_id='$id' "; $name_last_data=$DB->query($Query_last_data); $row_12_123=mysql_fetch_array($name_last_data); $des=trim(addslashes($row_12_123['description'])); $manufacturer_id=$row_12_123['manufacturer_id']; $tax_class_id=$row_12_123['tax_class_id']; $quantity=$row_12_123['quantity']; $vstatus=$row_12_123['vstatus']; $stock_status_id=$row_12_123['stock_status_id']; $ean=$row_12_123['ean']; $used_for=trim(addslashes($_REQUEST['used_for'])); ?> if(isset($_POST['sumbit'])) { if ($_REQUEST["form_action"] == "Insert") { if($_FILES['mast']['name']!="") { $size = 190; // the thumbnail height $filedir = '../../default/s-img/'; // the directory for the original image $thumbdir = '../../default/s-img/'; // the directory for the thumbnail image $maxfile = '200000000000'; $mode = '0666'; echo $userfile_name = $_FILES['mast']['name']; $userfile_tmp = $_FILES['mast']['tmp_name']; //$userfile_name = $_FILES['uploadFile']['name']; //$userfile_tmp = $_FILES['uploadFile']['tmp_name']; $getExt = explode ('.', $userfile_name); $rand_name = md5(rand(000,999)); /* $prod_img = $filedir.$mysql_insert_id.$i.$getExt[0].".".$getExt[1];*/ $new_file_name = $userfile_name; //exit(); $mysql_insert_id=$_REQUEST['id']; $new_file_name = str_replace('&','and',$new_file_name); $new_file_name = str_replace('#','',$new_file_name); $new_file_name = str_replace('+','',$new_file_name); $new_file_name = str_replace("'", '', $new_file_name); $new_file_name = str_replace(' ','',$new_file_name); $new_file_name_3730=$new_file_name; $new_file_name=($mysql_insert_id.$new_file_name); $prod_img = $filedir.$new_file_name; // original_images/456546565465465464jhh.jpg $items[] = $prod_img; $prod_img_thumb = $thumbdir.$getExt[0].".".$getExt[1]; move_uploaded_file($userfile_tmp, $prod_img); $upload_img = "UPDATE shop_product SET image='".$new_file_name."' WHERE product_id='".$mysql_insert_id."'"; $DB->query($upload_img); // $upload_img = mysql_query("UPDATE shop_product SET image='".$new_file_name."' WHERE id='".$mysql_insert_id."'"); } $kk=0; $new_j_id=$_REQUEST['id']; $Query123 = "SELECT * FROM `shop_product_image` WHERE `product_id`='$new_j_id' "; $nam_para=$DB->query($Query123); while ($row_para2= mysql_fetch_array($nam_para)) { echo $kk=$kk+1; $job_up_new_id=$row_para2['product_image_id']; $_FILES['newfile'.$kk]['name']; if($_FILES['newfile'.$kk]['name']!="") { $size = 190; // the thumbnail height $filedir = '../../default/f-img/'; // the directory for the original image $thumbdir = '../../default/f-img/'; // the directory for the thumbnail image $maxfile = '200000000000'; $mode = '0666'; $userfile_name = $_FILES['newfile'.$kk]['name']; $userfile_tmp = $_FILES['newfile'.$kk]['tmp_name']; $new_file_name = $userfile_name; $new_file_name= $_FILES['newfile'.$kk]['name']; $new_file_name = str_replace('&','and',$new_file_name); $new_file_name = str_replace('#','',$new_file_name); $new_file_name = str_replace('+','',$new_file_name); $new_file_name = str_replace("'", '', $new_file_name); $new_file_name = str_replace(' ','',$new_file_name); $new_file_name_3730=$new_file_name; $query_12 = mysql_query("SELECT product_image_id FROM shop_product_image where image='$new_file_name' "); $fetch_12 = mysql_fetch_array($query_12); $n_pay_date=mysql_num_rows($query_12); $mysql_insert_id=$fetch_12_3['nd_1']+1; if($n_pay_date>0) { $new_file_name=($mysql_insert_id.$new_file_name); } $new_file_name; echo $prod_img = $filedir.$new_file_name; // original_images/456546565465465464jhh.jpg $items[] = $prod_img; /*$prod_img_thumb = $thumbdir.$mysql_insert_id.$i.$getExt[0].".".$getExt[1]; $new_file_name = $mysql_insert_id.$i.$getExt[0].".".$getExt[1];*/ $prod_img_thumb = $thumbdir.$getExt[0].".".$getExt[1]; move_uploaded_file($userfile_tmp, $prod_img); $Queryd="UPDATE shop_product_image SET image='".trim(addslashes( $new_file_name ))."' WHERE `product_image_id`='".$job_up_new_id."'"; $DB->query($Queryd); } } $total_file=count($_POST['para']); foreach($_POST["para"] as $key=>$tmp_name) { if($_POST['para'][$key]!="") { $size = 190; // the thumbnail height $filedir = '../../default/f-img/'; // the directory for the original image $thumbdir = '../../default/f-img/'; // the directory for the thumbnail image $maxfile = '200000000000'; $mode = '0666'; $userfile_name_3730 = $_POST['para'][$key]; $userfile_name = $_POST['para'][$key]; $userfile_tmp = $_POST['para'][$key]; //$userfile_name = $_FILES['uploadFile']['name']; //$userfile_tmp = $_FILES['uploadFile']['tmp_name']; $getExt = explode ('.', $userfile_name); $rand_name = md5(rand(000,999)); /* $prod_img = $filedir.$mysql_insert_id.$i.$getExt[0].".".$getExt[1];*/ $new_file_name = $userfile_name; //exit(); $new_file_name = str_replace('&','and',$new_file_name); $new_file_name = str_replace('#','',$new_file_name); $new_file_name = str_replace('+','',$new_file_name); $new_file_name = str_replace("'", '', $new_file_name); $new_file_name = str_replace(' ','',$new_file_name); $userfile_name_3730=$new_file_name; $Query_pay_date = "SELECT image from shop_product_image where image='$userfile_name_3730'"; $name_pay_date=$DB->query($Query_pay_date); $n_pay_date=mysql_num_rows($name_pay_date); if($n_pay_date>0) { $Query_pay_date_new = "SELECT new_name from tbl_job_img where old_name='$userfile_name_3730'"; $name_pay_date_new=$DB->query($Query_pay_date_new); $row_12_123=mysql_fetch_array($name_pay_date_new); $mysql_insert_id_3730=$row_12_123['new_name']; $new_file_name=($mysql_insert_id_3730); } //$new_width=200; //$new_height=150; $tablename1="shop_product_image"; $product_id=$_REQUEST['id']; $Query="INSERT INTO $tablename1 VALUES (NULL,'".$product_id."','".trim( addslashes($userfile_name_3730) )."','0')"; $DB->query($Query); if($n_pay_date>0) { $Query_delete = "DELETE from tbl_job_img where old_name='$userfile_name_3730'"; $name_delete=$DB->query($Query_delete); } //echo ("INSERT INTO gallery(img_thumb,org_img) VALUES ('".$prod_img_thumb."','".$prod_img."')"); //$upload_img = mysql_query("UPDATE products SET img_thumb='".$prod_img_thumb."', org_img='".$prod_img."' WHERE id='".$_GET['id']."'"); } } date_default_timezone_set('Asia/Kolkata'); $date_ss = date('Y-m-d H:i:s ', time()); $tablename = "`tbl_doctor_appointment`"; $date=trim(addslashes($_REQUEST['date'])); $date = date("Y-m-d", strtotime($date)); $product_name=trim(addslashes($_REQUEST['product_name'])); $price=trim(addslashes($_REQUEST['price'])); $sell_price=trim(addslashes($_REQUEST['sell_price'])); $category=trim(addslashes($_REQUEST['category'])); $job_description=trim(addslashes($_REQUEST['job_description'])); $sp_ins=trim(addslashes($_REQUEST['sp_ins'])); $int_price=trim(addslashes($_REQUEST['int_price'])); $weight=trim(addslashes($_REQUEST['weight'])); $disease=0; $used_for=trim(addslashes($_REQUEST['used_for'])); $dosage=trim(addslashes($_REQUEST['dosage'])); $one_line=trim(addslashes($_REQUEST['one_line'])); $company=trim(addslashes($_REQUEST['company'])); $ean=trim(addslashes($_REQUEST['ean'])); $Query="UPDATE shop_product SET name='". $product_name."',meta_description='". $used_for."',tag='". $one_line."',meta_keyword='". $dosage."',product_url='". $sp_ins."',description='". $job_description."',manufacturer_id='". $category."',quantity='". $sell_price."',stock_status_id='". $weight."',price='". $price."',points='". $int_price."',tax_class_id='". $disease."',vstatus='". $company."',ean='". $ean."' WHERE `product_id`='".$_REQUEST['id']."'"; $DB->query($Query); header("location:view_product.php?sucess=sucess"); } } ?>