Server IP : 162.214.80.37 / Your IP : 216.73.216.83 Web Server : Apache System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : imyrqtmy ( 2189) PHP Version : 8.2.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home2/imyrqtmy/public_html/eventsbyshubhchintak/admin/dataQuery/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php ob_start(); require_once '../dbc.php'; require_once 'common-function.php'; $action = isset($_POST['action']) ? $_POST['action'] : ''; switch($action) { case 'addTopbanner': addTopbanner($conn); break; case 'editTopbanner': editTopbanner($conn); break; case 'addBottombanner': addBottombanner($conn); break; case 'editBottombanner': editBottombanner($conn); break; case 'addbannerOffer': addbannerOffer($conn); break; case 'editbannerOffer': editbannerOffer($conn); break; case 'addCategory': addCategory($conn); break; case 'editCategory': editCategory($conn); break; case 'addSubSubCategory': addSubSubCategory($conn); break; case 'editSubSubCategory': editSubSubCategory($conn); break; case 'addBrand': addBrand($conn); break; case 'editBrand': editBrand($conn); break; case 'addSubCategory': addSubCategory($conn); break; case 'editSubCategory': editSubCategory($conn); break; case 'addSize': addSize($conn); break; case 'editSize': editSize($conn); break; case 'addProduct': addProduct($conn); break; case 'editProduct': editProduct($conn); break; case 'addProductVarient': addProductVarient($conn); break; case 'editProductVarient': editProductVarient($conn); break; case 'addGallery': addGallery($conn); break; case 'editGallery': editGallery($conn); break; case 'addBlog': addBlog($conn); break; case 'editBlog': editBlog($conn); break; case 'addOffer': addOffer($conn); break; case 'editOffer': editOffer($conn); break; case 'addPromocode': addPromocode($conn); break; case 'editPromocode': editPromocode($conn); break; case 'addInvoice': addInvoice($conn); break; case 'editInvoice': editInvoice($conn); break; case 'sendOtp': sendOtp($conn); break; case 'addVendor'; addVendor($conn); break; case 'editVendor'; editVendor($conn); break; case 'addshoesOccasion'; addshoesOccasion($conn); break; case 'editshoesOccasion'; editshoesOccasion($conn); break; case 'addsoleType'; addsoleType($conn); break; case 'editsoleType'; editsoleType($conn); break; case 'addupperMaterial'; addupperMaterial($conn); break; case 'editupperMaterial'; editupperMaterial($conn); break; case 'addheelHeight'; addheelHeight($conn); break; case 'editheelHeight'; editheelHeight($conn); break; case 'addidealFor'; addidealFor($conn); break; case 'editidealFor'; editidealFor($conn); break; case 'addProducttype'; addProducttype($conn); break; case 'editProducttype'; editProducttype($conn); break; case 'addCity'; addCity($conn); break; case 'editCity'; editCity($conn); break; case 'addOccasion'; addOccasion($conn); break; case 'editOccasion'; editOccasion($conn); break; case 'addFaq'; addFaq($conn); break; case 'editFaq'; editFaq($conn); break; case 'addPackage': addPackage($conn); break; case 'editPackage': editPackage($conn); break; case 'addInclusion': addInclusion($conn); break; case 'editInclusion': editInclusion($conn); break; case 'editReview': editReview($conn); break; default : } $action2 = isset($_GET['action2']) ? $_GET['action2'] : ''; switch($action2) { case 'deleteTopbanner': deleteTopbanner($conn); break; case 'deleteBottombanner': deleteBottombanner($conn); break; case 'deleteBannerOffer': deleteBannerOffer($conn); break; case 'deleteCategory': deleteCategory($conn); break; case 'deleteBrand': deleteBrand($conn); break; case 'deleteSubCategory': deleteSubCategory($conn); break; case 'deleteSubSubCategory': deleteSubSubCategory($conn); break; case 'deleteSize': deleteSize($conn); break; case 'deleteCity': deleteCity($conn); break; case 'deleteProduct': deleteProduct($conn); break; case 'deleteProductVarient': deleteProductVarient($conn); break; case 'deleteGallery': deleteGallery($conn); break; case 'deleteBlog': deleteBlog($conn); break; case 'deleteContactEnquiry': deleteContactEnquiry($conn); break; case 'deleteSuggestion': deleteSuggestion($conn); break; case 'deleteOrder': deleteOrder($conn); break; case 'deletePromocode': deletePromocode($conn); break; case 'deletePromoCodeUser': deletePromoCodeUser($conn); break; case 'DeleteReview': DeleteReview($conn); break; case 'ActiveReview': ActiveReview($conn); break; case 'DeactiveReview': DeactiveReview($conn); break; case 'deleteInvoice': deleteInvoice($conn); break; case 'deleteVendor': deleteVendor($conn); break; case 'deleteshoesOccasion': deleteshoesOccasion($conn); break; case 'deletesoleType': deletesoleType($conn); break; case 'deleteupperMaterial': deleteupperMaterial($conn); break; case 'deleteheelHeight': deleteheelHeight($conn); break; case 'deleteidealFor': deleteidealFor($conn); break; case 'deleteProducttype': deleteProducttype($conn); break; case 'deleteOccasion': deleteOccasion($conn); break; case 'deleteLisitngenquiry': deleteLisitngenquiry($conn); break; case 'deleteFaq': deleteFaq($conn); break; case 'deletePackage': deletePackage($conn); break; case 'deletePackageimage': deletePackageimage($conn); break; case 'deleteInclusion': deleteInclusion($conn); break; default : } $action3 = isset($_GET['action3']) ? $_GET['action3'] : ''; switch($action3) { case 'activeCategory': activeCategory($conn); break; case 'deactiveCategory': deactiveCategory($conn); break; case 'activeVendor': activeVendor($conn); break; case 'deactiveVendor': deactiveVendor($conn); break; case 'activeSubcategory': activeSubcategory($conn); break; case 'deactiveSubcategory': deactiveSubcategory($conn); break; case 'activeSubsubcategory': activeSubsubcategory($conn); break; case 'deactiveSubsubcategory': deactiveSubsubcategory($conn); break; case 'activeProduct': activeProduct($conn); break; case 'deactiveProduct': deactiveProduct($conn); break; default : } /* edit review */ function editReview($conn) { $id = $_POST['txtid']; $reply = mysqli_real_escape_string($conn,$_POST['txtreply']); $review = mysqli_real_escape_string($conn,$_POST['txtreview']); $sqladd = mysqli_query($conn,"update tbl_review set reply='$reply', usercomment='$review', active_status='1' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { header('location:../review-list.php'); exit(); } else { header('location:../review-list.php'); exit(); } } /* Inclusin */ function addInclusion($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtinclusion']); $packageid = mysqli_real_escape_string($conn,$_POST['txtpackageid']); $sql="insert into tbl_inclusion(name,packageid,status) values('$name','$packageid','1')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('Location: ../add-inclusion.php?m=1&packageid='.$packageid); exit(); } else { header('Location: ../add-inclusion.php?m=1&packageid='.$packageid); exit(); } } function deleteInclusion($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; $pid=isset($_GET['pid'])? $_GET['pid'] : ""; //echo "value is ".$id; $del = "delete from tbl_inclusion where id ='$id'"; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../add-inclusion.php?m=1&packageid='.$pid); exit(); } else { header('Location: ../add-inclusion.php?m=1&packageid='.$pid); exit(); } } function editInclusion($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtinclusion']); $packageid = mysqli_real_escape_string($conn,$_POST['txtpackageid']); $sqladd = mysqli_query($conn,"update tbl_inclusion set name='$name', packageid='$packageid' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { header('Location: ../add-inclusion.php?m=1&packageid='.$packageid); exit(); } else { header('Location: ../add-inclusion.php?m=1&packageid='.$packageid); exit(); } } /* Inclusin close */ /*--------Delete package image-----------------------------------------------*/ function deletePackageimage($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; $pid =isset($_GET['pid'])? $_GET['pid'] : ""; //echo "value is ".$id; $del = "delete from tbl_package_image where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../add-package-image-list.php?&m=6&packageid='.$pid); } else { header('Location: ../add-package-image-list.php?m=7&packageid='.$pid); } } /*--------Delete package image close-----------------------------------------------*/ /*--------Add Package----------------------------------------------*/ function addPackage($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); $url = mysqli_real_escape_string($conn,$_POST['txturl']); $metakeyword = mysqli_real_escape_string($conn,$_POST['txtmetakeyword']); $metadescription = mysqli_real_escape_string($conn,$_POST['txtmetadescription']); $order_number = mysqli_real_escape_string($conn,$_POST['txtorder']); $shortdescription = mysqli_real_escape_string($conn,$_POST['txtshortdescription']); $price = mysqli_real_escape_string($conn,$_POST['txtprice']); $cityid = mysqli_real_escape_string($conn,$_POST['selcity']); $plateprice = mysqli_real_escape_string($conn,$_POST['txtplateprice']); $guestcapacity= mysqli_real_escape_string($conn,$_POST['txtguestcapacity']); date_default_timezone_set("Asia/Kolkata"); $date=date("d-m-Y"); $occasion = ""; //echo explode(",",$facility); foreach($_POST['seloccasion'] as $item) { $occasion.= $item.","; } $occasion = substr($occasion,0,strlen($occasion)-1); $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //---------------------condition--check dots------------------------ $dots=substr_count($imagefleimagename1, '.'); if($dots>1){header('Location: ../package.php?m=2&n=Rooms Image');exit(0);} //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $packagePath; global $packagePathThumb; $ImagePath = "$packagePath/"; $ImageThumbPath = "$packagePathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../package.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$newfile1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $imageThumbName = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $imageThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 1 end------------//////////// }else{ $newfile1=""; $imageThumbName=""; } $sql="insert into tbl_package(name,url,metakeyword,metadescription,description,image,thumb,order_number,status,date,price,city_id,occaison_id,plateprice,guestcapacity) values('$name','$url','$metakeyword','$metadescription','$shortdescription','$newfile1','$imageThumbName','$order_number','1','$date','$price','$cityid','$occasion','$plateprice','$guestcapacity')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('Location: ../package-list.php?m=1'); //echo "success"; } else { header('Location: ../package-list.php?m=0'); //echo "fail"; } } /*--------Add package close-----------------------------------------------*/ /*--------Delete Package -----------------------------------------------*/ function deletePackage($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_package where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../package-list.php?&m=6'); } else { header('Location: ../package-list.php?m=7'); } } /*--------Delete Package close-----------------------------------------------*/ /*--------Edit Package close-----------------------------------------------*/ function editPackage($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); $url = mysqli_real_escape_string($conn,$_POST['txturl']); $metakeyword = mysqli_real_escape_string($conn,$_POST['txtmetakeyword']); $metadescription = mysqli_real_escape_string($conn,$_POST['txtmetadescription']); $order_number = mysqli_real_escape_string($conn,$_POST['txtorder']); $shortdescription = mysqli_real_escape_string($conn,$_POST['txtshortdescription']); $price = mysqli_real_escape_string($conn,$_POST['txtprice']); $plateprice = mysqli_real_escape_string($conn,$_POST['txtplateprice']); $guestcapacity= mysqli_real_escape_string($conn,$_POST['txtguestcapacity']); $cityid = mysqli_real_escape_string($conn,$_POST['selcity']); $occasion = ""; //echo explode(",",$facility); foreach($_POST['seloccasion'] as $item) { $occasion.= $item.","; } $occasion = substr($occasion,0,strlen($occasion)-1); $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn,"select * from tbl_package where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 =0; $flagImage2 =0; // ------------- get all images name ------------------------- $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $packagePath; global $packagePathThumb; $ImagePath = "$packagePath/"; $ImageThumbPath = "$packagePathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ $flagImage1 =1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../package-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$InsertImage1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb1 = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb1; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $sqladd = mysqli_query($conn,"update tbl_package set name='$name', description='$shortdescription', metakeyword='$metakeyword', metadescription='$metadescription', url='$url', price='$price', order_number='$order_number', image='$InsertImage1', thumb='$InsertImagethumb1', city_id='$cityid', occaison_id='$occasion', plateprice='$plateprice', guestcapacity='$guestcapacity', status='1' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { // echo "1"; header('Location: ../package-list.php?m=4'); } else { // echo "0"; header('Location: ../package-list.php?m=5'); } } /*--------Edit package close-----------------------------------------------*/ /* faq */ function addFaq($conn) { $question = mysqli_real_escape_string($conn,$_POST['txtquestion']); $answer = mysqli_real_escape_string($conn,$_POST['txtanswer']); $order_number = mysqli_real_escape_string($conn,$_POST['txtorder']); $sql="insert into tbl_faq(question,answer,order_number,status) values('$question','$answer','$order_number','1')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('location:../faq-list.php'); exit(); } else { header('location:../faq-list.php'); exit(); } } function deleteFaq($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_faq where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('location:../faq-list.php'); exit(); } else { header('location:../faq-list.php'); exit(); } } function editFaq($conn) { $id = $_POST['txtid']; $question = mysqli_real_escape_string($conn,$_POST['txtquestion']); $answer = mysqli_real_escape_string($conn,$_POST['txtanswer']); $order_number = mysqli_real_escape_string($conn,$_POST['txtorder']); $sqladd = mysqli_query($conn,"update tbl_faq set question='$question', answer='$answer', order_number='$order_number' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { header('location:../faq-list.php'); exit(); } else { header('location:../faq-list.php'); exit(); } } /* faq */ /* Delete Lisitng Enquiry */ function deleteLisitngenquiry($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_listing_enquiry where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('location:../listing-enquiry-list.php'); exit(); } else { header('location:../listing-enquiry-list.php'); exit(); } } /* Occasion */ function addOccasion($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); $sql="insert into tbl_occasion(name,status) values('$name','1')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('location:../occasion.php'); exit(); } else { header('location:../occasion.php'); exit(); } } function deleteOccasion($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_occasion where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('location:../occasion.php'); exit(); } else { header('location:../occasion.php'); exit(); } } function editOccasion($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); $sqladd = mysqli_query($conn,"update tbl_occasion set name='$name' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { header('location:../occasion.php'); exit(); } else { header('location:../occasion.php'); exit(); } } /* occasion */ /*--------Add Bottom Banner-----------------------------------------------*/ function addBottombanner($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); $link = mysqli_real_escape_string($conn,$_POST['txtlink']); $order = mysqli_real_escape_string($conn,$_POST['txtorder']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //---------------------condition--check dots------------------------ $dots=substr_count($imagefleimagename1, '.'); if($dots>1){header('Location: ../bottom-banner.php?m=2&n=Rooms Image');exit(0);} //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $bannerbottomPath; global $bannerbottomPathThumb; $ImagePath = "$bannerbottomPath/"; $ImageThumbPath = "$bannerbottomPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../bottom-banner.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$newfile1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $imageThumbName = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $imageThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 1 end------------//////////// }else{ $newfile1=""; $imageThumbName=""; } $sql="insert into tbl_bannerbottom(name,order_number,image,thumb,status,link) values('$name','$order','$newfile1','$imageThumbName','$status','$link')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('Location: ../bottom-banner-list.php?m=1'); //echo "success"; } else { header('Location: ../bottom-banner-list.php?m=0'); //echo "fail"; } } /*--------Add Bottom Banner close-----------------------------------------------*/ /*--------Delete bottom Banner -----------------------------------------------*/ function deleteBottombanner($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_bannerbottom where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../bottom-banner-list.php?&m=6'); } else { header('Location: ../bottom-banner-list.php?m=7'); } } /*--------Delete Bottom Banner close-----------------------------------------------*/ /*--------Edit Bottom Banner close-----------------------------------------------*/ function editBottombanner($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); $order = mysqli_real_escape_string($conn,$_POST['txtorder']); $link = mysqli_real_escape_string($conn,$_POST['txtlink']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn,"select * from tbl_bannerbottom where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 =0; $flagImage2 =0; // ------------- get all images name ------------------------- $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $bannerbottomPath; global $bannerPathbottomThumb; $ImagePath = "$bannerbottomPath/"; $ImageThumbPath = "$bannerbottomPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ $flagImage1 =1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../bottom-banner-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$InsertImage1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb1 = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb1; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $sqladd = mysqli_query($conn,"update tbl_bannerbottom set name='$name', order_number='$order', image='$InsertImage1', thumb='$InsertImagethumb1', status='$status', link='$link' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { // echo "1"; header('Location: ../bottom-banner-list.php?m=4'); } else { // echo "0"; header('Location: ../bottom-banner-list.php?m=5'); } } /*--------Edit bottom banner close-----------------------------------------------*/ /* product active --*/ function activeProduct($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; $vendorid =isset($_GET['vendorid'])? $_GET['vendorid'] : ""; //echo "value is ".$id; $del = "update tbl_product set adminstatus='1' where id = '$id'"; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../pending-product-list.php?vendorid='.$vendorid); // echo "<script>window.location.href='../pending-product-list.php?vendorid='.$vendorid;</script>"; exit; } else { // header('Location: ../category-list.php?m=19'); header('Location: ../pending-product-list.php?vendorid='.$vendorid); exit; } } /* product active close --*/ /* product deactive --*/ function deactiveProduct($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; $vendorid =isset($_GET['vendorid'])? $_GET['vendorid'] : ""; //echo "value is ".$id; $del = "update tbl_product set adminstatus='0' where id = '$id'"; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../active-product-list.php?vendorid='.$vendorid); // echo "<script>window.location.href='../pending-product-list.php?vendorid='.$vendorid;</script>"; exit; } else { // header('Location: ../category-list.php?m=19'); header('Location: ../active-product-list.php?vendorid='.$vendorid); exit; } } /* product deactive close --*/ /* City */ function addCity($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtcityname']); $sql="insert into tbl_city(name,status) values('$name','1')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('location:../city.php'); exit(); } else { header('location:../city.php'); exit(); } } function deleteCity($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_city where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('location:../city.php'); exit(); } else { header('location:../city.php'); exit(); } } function editCity($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtcityname']); $sqladd = mysqli_query($conn,"update tbl_city set name='$name' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { header('location:../city.php'); exit(); } else { header('location:../city.php'); exit(); } } /* City close */ /*--------Add Product Type-----------------------------------------------*/ function addProducttype($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); $order = mysqli_real_escape_string($conn,$_POST['txtorder']); global $producttypePath; $ImagePath = "$producttypePath/"; $image1 =trim($_FILES['image1fleimage']['name']); $randd=rand(1000,9999); $image11= str_replace(' ', '-', strtolower($image1)); $newimage1="PT".$randd.$image11; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$newimage1); $sql="insert into tbl_producttype(name,image,status,order_number) values('$name','$newimage1','1','$order')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { // header('Location: ../category-list.php?m=1'); echo "<script>window.location.href='../product-type-list.php?m=1';</script>"; exit; //echo "success"; } else { header('Location: ../product-type-list.php?m=0'); //echo "fail"; } } /*--------Add Product type close-----------------------------------------------*/ /*--------Delete Product Type -----------------------------------------------*/ function deleteProducttype($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_producttype where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { echo "<script>window.location.href='../product-type-list.php?m=6';</script>"; exit; } else { echo "<script>window.location.href='../product-type-list.php?m=7';</script>"; exit; } } /*--------Delete Product close-----------------------------------------------*/ /*--------Edit Product Type close-----------------------------------------------*/ function editProducttype($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); $order = mysqli_real_escape_string($conn,$_POST['txtorder']); $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn,"select * from tbl_producttype where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 =0; $flagImage2 =0; // ------------- get all images name ------------------------- $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $producttypePath; global $producttypePathThumb; $ImagePath = "$producttypePath/"; $ImageThumbPath = "$producttypePathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ $flagImage1 =1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-type-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$InsertImage1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb1 = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb1; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $sqladd = mysqli_query($conn,"update tbl_producttype set name='$name', image='$InsertImage1', thumb='$InsertImagethumb1', order_number='$order', status='1' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { // echo "1"; echo "<script>window.location.href='../product-type-list.php?m=4';</script>"; exit; } else { // echo "0"; echo "<script>window.location.href='../product-type-list.php?m=5';</script>"; exit; } } /*--------Edit product type close-----------------------------------------------*/ /* heel ideal for */ function addidealFor($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); $shoe_id = mysqli_real_escape_string($conn,$_POST['txtshoescategory']); $sql="insert into tbl_ideal_for(name,shoe_id,status) values('$name','$shoe_id','1')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('location:../shoes-ideal-for.php'); exit(); } else { header('location:../shoes-ideal-for.php'); exit(); } } function deleteidealFor($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_ideal_for where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('location:../shoes-ideal-for.php'); exit(); } else { header('location:../shoes-ideal-for.php'); exit(); } } function editidealFor($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); $sqladd = mysqli_query($conn,"update tbl_ideal_for set name='$name' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { header('location:../shoes-ideal-for.php'); exit(); } else { header('location:../shoes-ideal-for.php'); exit(); } } /* Ideal For close */ /* heel height */ function addheelHeight($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); $shoe_id = mysqli_real_escape_string($conn,$_POST['txtshoescategory']); $sql="insert into tbl_heel_height(name,shoe_id,status) values('$name','$shoe_id','1')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('location:../shoes-heel-height.php'); exit(); } else { header('location:../shoes-heel-height.php'); exit(); } } function deleteheelHeight($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_heel_height where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('location:../shoes-heel-height.php'); exit(); } else { header('location:../shoes-heel-height.php'); exit(); } } function editheelHeight($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); $sqladd = mysqli_query($conn,"update tbl_heel_height set name='$name' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { header('location:../shoes-heel-height.php'); exit(); } else { header('location:../shoes-heel-height.php'); exit(); } } /* heel height close */ function addupperMaterial($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); $shoe_id = mysqli_real_escape_string($conn,$_POST['txtshoescategory']); $sql="insert into tbl_upper_material(name,shoe_id,status) values('$name','$shoe_id','1')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('location:../shoes-upper-material.php'); exit(); } else { header('location:../shoes-upper-material.php'); exit(); } } function deleteupperMaterial($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_upper_material where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('location:../shoes-upper-material.php'); exit(); } else { header('location:../shoes-upper-material.php'); exit(); } } function editupperMaterial($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); $sqladd = mysqli_query($conn,"update tbl_upper_material set name='$name' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { header('location:../shoes-upper-material.php'); exit(); } else { header('location:../shoes-upper-material.php'); exit(); } } function addsoleType($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); $shoe_id = mysqli_real_escape_string($conn,$_POST['txtshoescategory']); $sql="insert into tbl_sole_type(name,shoe_id,status) values('$name','$shoe_id','1')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('location:../shoes-sole-type.php'); exit(); } else { header('location:../shoes-sole-type.php'); exit(); } } /*--------Add addsoleTypen-----------------------------------------------*/ /*--------Delete deletesoleType -----------------------------------------------*/ function deletesoleType($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_sole_type where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('location:../shoes-sole-type.php'); exit(); } else { header('location:../shoes-sole-type.php'); exit(); } } /*--------Delete deletesoleType close-----------------------------------------------*/ /*--------Edit editsoleType -----------------------------------------------*/ function editsoleType($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); $sqladd = mysqli_query($conn,"update tbl_sole_type set name='$name' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { header('location:../shoes-sole-type.php'); exit(); } else { header('location:../shoes-sole-type.php'); exit(); } } /*--------Edit editsoleType close-----------------------------------------------*/ /*--------Add addshoesOccasion-----------------------------------------------*/ function addshoesOccasion($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); $shoe_id = mysqli_real_escape_string($conn,$_POST['txtshoescategory']); $sql="insert into tbl_shoes_occasion(name,shoe_id,status) values('$name','$shoe_id','1')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('location:../shoes-occasion.php'); exit(); } else { header('location:../shoes-occasion.php'); exit(); } } /*--------Add addshoesOccasion-----------------------------------------------*/ /*--------Delete addshoesOccasion -----------------------------------------------*/ function deleteshoesOccasion($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_shoes_occasion where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('location:../shoes-occasion.php'); exit(); } else { header('location:../shoes-occasion.php'); exit(); } } /*--------Delete addshoesOccasion close-----------------------------------------------*/ /*--------Edit addshoesOccasion -----------------------------------------------*/ function editshoesOccasion($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); $sqladd = mysqli_query($conn,"update tbl_shoes_occasion set name='$name' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { header('location:../shoes-occasion.php'); exit(); } else { header('location:../shoes-occasion.php'); exit(); } } /*--------Edit addshoesOccasionr close-----------------------------------------------*/ /*--------Edit Vendor-----------------------------------------------*/ function editVendor($conn) { $id = $_POST['txtid']; $vendorname = mysqli_real_escape_string($conn,$_POST['txtname']); $number = mysqli_real_escape_string($conn,$_POST['txtvendornumber']); $city = mysqli_real_escape_string($conn,$_POST['selcity']); $businesscategory = mysqli_real_escape_string($conn,$_POST['selcategory']); $businesssubcategory = mysqli_real_escape_string($conn,$_POST['selsubcategory']); $email = mysqli_real_escape_string($conn,$_POST['txtemail']); $password =md5( $_REQUEST['txtpassword']); $businessname = mysqli_real_escape_string($conn,$_POST['txtbusinessname']); $sqladd = mysqli_query($conn,"update tbl_vendor set name='$vendorname', number='$number', email='$email', password='$password', businessname='$businessname', city='$city', category_id='$businesscategory', sub_category_id='$businesssubcategory' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { // echo "1"; // header('Location: ../vendor-list.php?m=4'); echo "<script>window.location.href='../vendor-list.php?&m=4';</script>"; exit; } else { // echo "0"; // header('Location: ../vendor-list.php?m=5'); echo "<script>window.location.href='../vendor-list.php?&m=5';</script>"; exit; } } /*--------Edit Vendor close-----------------------------------------------*/ /*--------Add Vendor Close-----------------------------------------------*/ function addVendor($conn) { $vendorname = mysqli_real_escape_string($conn,$_POST['txtname']); $otpid = mysqli_real_escape_string($conn,$_POST['txtotpid']); $otp = mysqli_real_escape_string($conn,$_POST['txtotp']); $number = mysqli_real_escape_string($conn,$_POST['txtvendornumber']); $businesscategory = mysqli_real_escape_string($conn,$_POST['selcategory']); $email = mysqli_real_escape_string($conn,$_POST['txtemail']); $password =md5( $_REQUEST['txtpassword']); $businessname = mysqli_real_escape_string($conn,$_POST['txtbusinessname']); $businessaddress = mysqli_real_escape_string($conn,$_POST['txtbusinessaddress']); $rand=rand(100000,999999); $vendorid="HMV".$rand; date_default_timezone_set("Asia/Kolkata"); $registrationdate=date("d-m-Y / h:i:s a"); $uploadFolder = '../../media/vendordocument/'; #aadharcard $imageTmpName = $_FILES['txtadharcard']['tmp_name']; $imageName2 = $_FILES['txtadharcard']['name']; $imageName=$userid.$imageName2; move_uploaded_file($imageTmpName,$uploadFolder.$imageName); #gst $imageTmpName2 = $_FILES['txtgst']['tmp_name']; $imageName22 = $_FILES['txtgst']['name']; $imageName2=$userid.$imageName22; move_uploaded_file($imageTmpName2,$uploadFolder.$imageName2); $sql="select * from tbl_vendorotp where otp='$otp' and otpid='$otpid'"; $run=mysqli_query($conn,$sql) or die(mysqli_error($conn)); $row=mysqli_num_rows($run); if($row==1) { $sql="insert into tbl_vendor(otp_id,vendor_name,email,mobile,password,businessname,businessaddress,category_id,vendorid,registration_datee,status,aadharcard,gst) values('$otpid','$vendorname','$email','$number','$password','$businessname','$businessaddress','$businesscategory','$vendorid','$registrationdate','1','$imageName','$imageName2')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { $update = "update tbl_vendorotp set status='1',otp='0' where otpid ='$otpid'"; if(mysqli_query($conn,$update) or die(mysqli_error($conn))) { // echo "OTP WORONG"; echo "<script>window.location.href='../vendor-list.php?&m=33';</script>"; exit; } else { // echo "OTP WORONG"; echo "<script>window.location.href='../vendor.php?m21&m=31&otpid=$otpid';</script>"; exit; } //header('Location: vendor-number-otp.php?id='.$otpid); //echo "success"; } else { // echo "OTP WORONG"; echo "<script>window.location.href='../vendor.php?m21&m=31&otpid=$otpid';</script>"; exit; } } else { // echo "OTP WORONG"; echo "<script>window.location.href='../vendor.php?m21&m=31&otpid=$otpid';</script>"; exit; } } /*--------Add Vendor close-----------------------------------------------*/ /* subsubcategory active --*/ function activeSubsubcategory($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "update tbl_sub_subcategory set status='1' where id = '$id'"; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { echo "<script>window.location.href='../sub-sub-category-list.php?&m=27';</script>"; exit; } else { echo "<script>window.location.href='../sub-sub-category-list.php?m=27';</script>"; exit; } } /* subsubcategory active close --*/ /* subsubcategory De-active --*/ function deactiveSubsubcategory($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "update tbl_sub_subcategory set status='0' where id = '$id'"; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { echo "<script>window.location.href='../sub-sub-category-list.php?&m=28';</script>"; exit; } else { echo "<script>window.location.href='../sub-sub-category-list.php?&m=28';</script>"; exit; } } /* subsubcategory De- active close --*/ /* subcategory active --*/ function activeSubcategory($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "update tbl_subcategory set status='1' where id = '$id'"; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { echo "<script>window.location.href='../sub-category-list.php?&m=25';</script>"; exit; } else { echo "<script>window.location.href='../sub-category-list.php?m=25';</script>"; exit; } } /* subcategory active close --*/ /* vsubcategory De-active --*/ function deactiveSubcategory($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "update tbl_subcategory set status='0' where id = '$id'"; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { echo "<script>window.location.href='../sub-category-list.php?&m=26';</script>"; exit; } else { echo "<script>window.location.href='../sub-category-list.php?&m=26';</script>"; exit; } } /* subcategory De- active close --*/ /*--------Delete Vendor -----------------------------------------------*/ function deleteVendor($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; $otpid =isset($_GET['otpid'])? $_GET['otpid'] : ""; //echo "value is ".$id; $del = "delete from tbl_vendor where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { $delotp = "delete from tbl_vendorotp where otpid= '$otpid'"; if(mysqli_query($conn,$delotp) or die(mysqli_error($conn))) { echo "<script>window.location.href='../vendor-list.php?&m=6';</script>"; exit; } else { echo "<script>window.location.href='../vendor-list.php?m=7';</script>"; exit; } // header('Location: ../vendor-list.php?&m=6'); } else { echo "<script>window.location.href='../vendor-list.php?m=7';</script>"; exit; } } /*--------Delete vendor close-----------------------------------------------*/ /* vendor active --*/ function activeVendor($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "update tbl_vendor set status='1' where id = '$id'"; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { echo "<script>window.location.href='../vendor-list.php?&m=23';</script>"; exit; } else { echo "<script>window.location.href='../vendor-list.php?m=23';</script>"; exit; } } /* vendor active close --*/ /* vendor De-active --*/ function deactiveVendor($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "update tbl_vendor set status='0' where id = '$id'"; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { echo "<script>window.location.href='../vendor-list.php?&m=24';</script>"; exit; } else { echo "<script>window.location.href='../vendor-list.php?&m=24';</script>"; exit; } } /* vendor De- active close --*/ /* send otp */ function sendOtp($conn) { $otp = rand(1000,9999); $otpid = rand(100000,999999); $number = mysqli_real_escape_string($conn,$_POST['txtnumber']); $sql="select * from tbl_vendorotp where mobile_number='$number' and status='1'"; $run=mysqli_query($conn,$sql) or die(mysqli_error($conn)); $row=mysqli_num_rows($run); if($row==1) { // header('Location: ../vendor.php?m23'); echo "<script>window.location.href='../vendor.php?m23';</script>"; exit; } else { $sql="insert into tbl_vendorotp(mobile_number,otp,status,otpid) values('$number','$otp','0','$otpid')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { // header('Location: ../vendor.php?m21&otpid='.$otpid); // message api $message = rawurlencode($otp .' is your OTP from Hind Search. Please do not share OTP with anyone.'); $data="http://www.alots.in/sms-panel/api/http/index.php?username=AgraSearch&apikey=0023F-E616D&apirequest=Text&sender=HINDSR&mobile=$number&message=$message&route=TRANS&TemplateID=1507162643872930661&format=JSON"; // Send the GET request with cURL $ch = curl_init($data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); echo "<script>window.location.href='../vendor.php?m21&otpid=$otpid';</script>"; exit; //echo "success"; } else { header('Location: ../vendor.php?m22'); echo "<script>window.location.href='../vendor.php?m22';</script>"; exit; //echo "fail"; } } } // send otp close /* category active --*/ function activeCategory($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "update tbl_category set status='1' where id = '$id'"; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { // header('Location: ../category-list.php?&m=19'); echo "<script>window.location.href='../category-list.php?&m=19';</script>"; exit; } else { // header('Location: ../category-list.php?m=19'); echo "<script>window.location.href='../category-list.php?&m=19';</script>"; exit; } } /* category active close --*/ /* category De- active --*/ function deactiveCategory($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "update tbl_category set status='0' where id = '$id'"; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { // header('Location: ../category-list.php?&m=20'); echo "<script>window.location.href='../category-list.php?&m=20';</script>"; exit; } else { // header('Location: ../category-list.php?m=20'); echo "<script>window.location.href='../category-list.php?&m=20';</script>"; exit; } } /* category De- active close --*/ /*--------Add Sub Sub Category-----------------------------------------------*/ function addSubSubCategory($conn) { $category = mysqli_real_escape_string($conn,$_POST['selcategory']); $subcategory = mysqli_real_escape_string($conn,$_POST['selsubcategory']); $subsubcategoryname = mysqli_real_escape_string($conn,$_POST['txtname']); $order = mysqli_real_escape_string($conn,$_POST['txtorder']); $url = mysqli_real_escape_string($conn,$_POST['txturl']); $metakeyword = mysqli_real_escape_string($conn,$_POST['txtmetakeyword']); $metadescription = mysqli_real_escape_string($conn,$_POST['txtmetadescription']); $product_type_id = mysqli_real_escape_string($conn,$_POST['selproducttype']); if(isset($_POST['txtwholesale'])){$wholesale=1;}else{$wholesale=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //---------------------condition--check dots------------------------ $dots=substr_count($imagefleimagename1, '.'); if($dots>1){header('Location: ../sub-sub-category.php?m=2&n=Rooms Image');exit(0);} //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $subsubcategoryPath; global $subsubcategoryPathThumb; $ImagePath = "$subsubcategoryPath/"; $ImageThumbPath = "$subsubcategoryPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../sub-sub-category.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$newfile1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $imageThumbName = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $imageThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 1 end------------//////////// }else{ $newfile1=""; $imageThumbName=""; } $sql="insert into tbl_sub_subcategory(category_id,sub_category_id,name,image,thumb,url,order_number,status, metakeyword,metadescription,product_type_id,wholesale) values('$category','$subcategory','$subsubcategoryname','$newfile1','$imageThumbName','$url','$order','1','$metakeyword','$metadescription','$product_type_id','$wholesale')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { echo "<script>window.location.href='../sub-sub-category-list.php?&m=1';</script>"; exit; //echo "success"; } else { echo "<script>window.location.href='../sub-sub-category-list.php?&m=0';</script>"; exit; //echo "fail"; } } /*--------Add Sub Sub Category close-----------------------------------------------*/ /*--------Delete Sub Sub Category -----------------------------------------------*/ function deleteSubSubCategory($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $sql="SELECT * FROM tbl_product where sub_sub_category_id='$id'"; $run=mysqli_query($conn,$sql) or die(mysqli_error($conn)); $row=mysqli_num_rows($run); if($row<1) { $del = "delete from tbl_sub_subcategory where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { echo "<script>window.location.href='../sub-sub-category-list.php?&m=6';</script>"; exit; } else { echo "<script>window.location.href='../sub-sub-category-list.php?&m=7';</script>"; exit; } } else { echo "<script>window.location.href='../sub-sub-category-list.php?&m=18';</script>"; exit; } } /*--------Delete Sub Sub Category close-----------------------------------------------*/ /*--------Edit Sub Category close-----------------------------------------------*/ function editSubSubCategory($conn) { $id = $_POST['txtid']; $category = mysqli_real_escape_string($conn,$_POST['selcategory']); $subcategory = mysqli_real_escape_string($conn,$_POST['selsubcategory']); $subsubcategoryname = mysqli_real_escape_string($conn,$_POST['txtname']); $order = mysqli_real_escape_string($conn,$_POST['txtorder']); $url = mysqli_real_escape_string($conn,$_POST['txturl']); $metakeyword = mysqli_real_escape_string($conn,$_POST['txtmetakeyword']); $metadescription = mysqli_real_escape_string($conn,$_POST['txtmetadescription']); $product_type_id = mysqli_real_escape_string($conn,$_POST['selproducttype']); if(isset($_POST['txtwholesale'])){$wholesale=1;}else{$wholesale=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn,"select * from tbl_sub_subcategory where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 =0; $flagImage2 =0; // ------------- get all images name ------------------------- $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $subsubcategoryPath; global $subsubcategoryPathThumb; $ImagePath = "$subsubcategoryPath/"; $ImageThumbPath = "$subsubcategoryPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ $flagImage1 =1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../sub-sub-category-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$InsertImage1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb1 = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb1; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $sqladd = mysqli_query($conn,"update tbl_sub_subcategory set category_id='$category', sub_category_id='$subcategory', name='$subsubcategoryname', image='$InsertImage1', thumb='$InsertImagethumb1', url='$url', order_number='$order', metakeyword='$metakeyword', metadescription='$metadescription', product_type_id ='$product_type_id', wholesale='$wholesale' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { // echo "1"; echo "<script>window.location.href='../sub-sub-category-list.php?&m=4';</script>"; exit; } else { // echo "0"; echo "<script>window.location.href='../sub-sub-category-list.php?&m=5';</script>"; exit; } } /*--------Edit Sub Sub Category close-----------------------------------------------*/ /*--------Add Brand-----------------------------------------------*/ function addBrand($conn) { $categoryname = mysqli_real_escape_string($conn,$_POST['txtname']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //---------------------condition--check dots------------------------ $dots=substr_count($imagefleimagename1, '.'); if($dots>1){header('Location: ../brand.php?m=2&n=Rooms Image');exit(0);} //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale-----a function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $brandPath; global $brandPathThumb; $ImagePath = "$brandPath/"; $ImageThumbPath = "$brandPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../brand.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$newfile1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $imageThumbName = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $imageThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 1 end------------//////////// }else{ $newfile1=""; $imageThumbName=""; } $sql="insert into tbl_brand(name,image,thumb,status) values('$categoryname','$newfile1','$imageThumbName','$status')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('Location: ../brand-list.php?m=1'); //echo "success"; } else { header('Location: ../brand-list.php?m=0'); //echo "fail"; } } /*--------Add Brand close-----------------------------------------------*/ /*--------Delete Brand -----------------------------------------------*/ function deleteBrand($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_brand where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../brand-list.php?&m=6'); } else { header('Location: ../brand-list.php?m=7'); } } /*--------Delete Brand close-----------------------------------------------*/ /*--------Edit BRAND close-----------------------------------------------*/ function editBrand($conn) { $id = $_POST['txtid']; $categoryname = mysqli_real_escape_string($conn,$_POST['txtname']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn,"select * from tbl_brand where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 =0; $flagImage2 =0; // ------------- get all images name ------------------------- $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $brandPath; global $brandPathThumb; $ImagePath = "$brandPath/"; $ImageThumbPath = "$brandPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ $flagImage1 =1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../brand-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$InsertImage1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb1 = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb1; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $sqladd = mysqli_query($conn,"update tbl_brand set name='$categoryname', image='$InsertImage1', thumb='$InsertImagethumb1', status='$status' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { // echo "1"; header('Location: ../brand-list.php?m=4'); } else { // echo "0"; header('Location: ../brand-list.php?m=5'); } } /*--------Edit Brand close-----------------------------------------------*/ /*--------Add Size-----------------------------------------------*/ function addSize($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $sql="insert into tbl_size(name,status) values('$name','$status')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('Location: ../size-list.php?m=1'); //echo "success"; } else { header('Location: ../size-list.php?m=0'); //echo "fail"; } } /*--------Add Size close-----------------------------------------------*/ /*--------Delete Size -----------------------------------------------*/ function deleteSize($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_size where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../size-list.php?&m=6'); } else { header('Location: ../size-list.php?m=7'); } } /*--------Delete Size close-----------------------------------------------*/ /*--------Edit Size close-----------------------------------------------*/ function editSize($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $sqladd = mysqli_query($conn,"update tbl_size set name='$name', status='$status' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { // echo "1"; header('Location: ../size-list.php?m=4'); } else { // echo "0"; header('Location: ../size-list.php?m=5'); } } /*--------Edit Size close-----------------------------------------------*/ /*--------Add Banner Offer-----------------------------------------------*/ function addbannerOffer($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); $order = mysqli_real_escape_string($conn,$_POST['txtorder']); $link = mysqli_real_escape_string($conn,$_POST['txtlink']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //---------------------condition--check dots------------------------ $dots=substr_count($imagefleimagename1, '.'); if($dots>1){header('Location: ../offer-banner.php?m=2&n=Rooms Image');exit(0);} //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $bannerofferPath; global $bannerofferPathThumb; $ImagePath = "$bannerofferPath/"; $ImageThumbPath = "$bannerofferPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../offer-banner.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$newfile1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $imageThumbName = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $imageThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 1 end------------//////////// }else{ $newfile1=""; $imageThumbName=""; } $sql="insert into tbl_banneroffer(name,order_number,image,thumb,status,link) values('$name','$order','$newfile1','$imageThumbName','$status','$link')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('Location: ../offer-banner-list.php?m=1'); //echo "success"; } else { header('Location: ../offer-banner-list.php?m=0'); //echo "fail"; } } /*--------Add Banner offer close-----------------------------------------------*/ /*--------Delete Banner offer -----------------------------------------------*/ function deleteBannerOffer($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_banneroffer where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../offer-banner-list.php?&m=6'); } else { header('Location: ../offer-banner-list.php?m=7'); } } /*--------Delete Banner Offer close-----------------------------------------------*/ /*--------Edit Banner Offerclose-----------------------------------------------*/ function editbannerOffer($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); $order = mysqli_real_escape_string($conn,$_POST['txtorder']); $link = mysqli_real_escape_string($conn,$_POST['txtlink']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn,"select * from tbl_banneroffer where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 =0; $flagImage2 =0; // ------------- get all images name ------------------------- $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $bannerofferPath; global $bannerofferPathThumb; $ImagePath = "$bannerofferPath/"; $ImageThumbPath = "$bannerofferPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ $flagImage1 =1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../offer-banner-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$InsertImage1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb1 = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb1; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $sqladd = mysqli_query($conn,"update tbl_banneroffer set name='$name', order_number='$order', image='$InsertImage1', thumb='$InsertImagethumb1', status='$status', link='$link' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { // echo "1"; header('Location: ../offer-banner-list.php?m=4'); } else { // echo "0"; header('Location: ../offer-banner-list.php?m=5'); } } /*--------Edit banner Offer close-----------------------------------------------*/ /*--------Add Banner-----------------------------------------------*/ function addTopbanner($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); $link = mysqli_real_escape_string($conn,$_POST['txtlink']); $order = mysqli_real_escape_string($conn,$_POST['txtorder']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //---------------------condition--check dots------------------------ $dots=substr_count($imagefleimagename1, '.'); if($dots>1){header('Location: ../top-banner.php?m=2&n=Rooms Image');exit(0);} //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $bannerPath; global $bannerPathThumb; $ImagePath = "$bannerPath/"; $ImageThumbPath = "$bannerPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../top-banner.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$newfile1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $imageThumbName = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $imageThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 1 end------------//////////// }else{ $newfile1=""; $imageThumbName=""; } $sql="insert into tbl_banner(name,order_number,image,thumb,status,link) values('$name','$order','$newfile1','$imageThumbName','$status','$link')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('Location: ../top-banner-list.php?m=1'); //echo "success"; } else { header('Location: ../top-banner-list.php?m=0'); //echo "fail"; } } /*--------Add Top Banner close-----------------------------------------------*/ /*--------Delete Banner -----------------------------------------------*/ function deleteTopbanner($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_banner where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../top-banner-list.php?&m=6'); } else { header('Location: ../top-banner-list.php?m=7'); } } /*--------Delete Top Banner close-----------------------------------------------*/ /*--------Edit Top Banner close-----------------------------------------------*/ function editTopbanner($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); $order = mysqli_real_escape_string($conn,$_POST['txtorder']); $link = mysqli_real_escape_string($conn,$_POST['txtlink']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn,"select * from tbl_banner where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 =0; $flagImage2 =0; // ------------- get all images name ------------------------- $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $bannerPath; global $bannerPathThumb; $ImagePath = "$bannerPath/"; $ImageThumbPath = "$bannerPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ $flagImage1 =1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../top-banner-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$InsertImage1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb1 = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb1; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $sqladd = mysqli_query($conn,"update tbl_banner set name='$name', order_number='$order', image='$InsertImage1', thumb='$InsertImagethumb1', status='$status', link='$link' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { // echo "1"; header('Location: ../top-banner-list.php?m=4'); } else { // echo "0"; header('Location: ../top-banner-list.php?m=5'); } } /*--------Edit Top banner close-----------------------------------------------*/ /*--------Add Category-----------------------------------------------*/ function addCategory($conn) { $categoryname = mysqli_real_escape_string($conn,$_POST['txtname']); $order = mysqli_real_escape_string($conn,$_POST['txtorder']); $url = mysqli_real_escape_string($conn,$_POST['txturl']); $metakeyword = mysqli_real_escape_string($conn,$_POST['txtmetakeyword']); $metadescription = mysqli_real_escape_string($conn,$_POST['txtmetadescription']); $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //---------------------condition--check dots------------------------ $dots=substr_count($imagefleimagename1, '.'); if($dots>1){header('Location: ../category.php?m=2&n=Rooms Image');exit(0);} //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $categoryPath; global $categoryPathThumb; $ImagePath = "$categoryPath/"; $ImageThumbPath = "$categoryPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../category.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$newfile1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $imageThumbName = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $imageThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 1 end------------//////////// }else{ $newfile1=""; $imageThumbName=""; } $sql="insert into tbl_category(name,image,thumb,url,order_number,metakeyword,metadescription,status) values('$categoryname','$newfile1','$imageThumbName','$url','$order','$metakeyword','$metadescription','1')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { // header('Location: ../category-list.php?m=1'); echo "<script>window.location.href='../category-list.php?m=1';</script>"; exit; //echo "success"; } else { header('Location: ../category-list.php?m=0'); //echo "fail"; } } /*--------Add Category close-----------------------------------------------*/ /*--------Delete Category -----------------------------------------------*/ function deleteCategory($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $sql="SELECT * FROM tbl_subcategory where category_id='$id'"; $run=mysqli_query($conn,$sql) or die(mysqli_error($conn)); $row=mysqli_num_rows($run); if($row<1) { $del = "delete from tbl_category where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { echo "<script>window.location.href='../category-list.php?m=6';</script>"; exit; } else { echo "<script>window.location.href='../category-list.php?m=7';</script>"; exit; } } else { echo "<script>window.location.href='../category-list.php?m=17';</script>"; exit; } } /*--------Delete Category close-----------------------------------------------*/ /*--------Edit Category close-----------------------------------------------*/ function editCategory($conn) { $id = $_POST['txtid']; $categoryname = mysqli_real_escape_string($conn,$_POST['txtname']); $order = mysqli_real_escape_string($conn,$_POST['txtorder']); $url = mysqli_real_escape_string($conn,$_POST['txturl']); $metakeyword = mysqli_real_escape_string($conn,$_POST['txtmetakeyword']); $metadescription = mysqli_real_escape_string($conn,$_POST['txtmetadescription']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn,"select * from tbl_category where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 =0; $flagImage2 =0; // ------------- get all images name ------------------------- $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $categoryPath; global $categoryPathThumb; $ImagePath = "$categoryPath/"; $ImageThumbPath = "$categoryPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ $flagImage1 =1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../category-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$InsertImage1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb1 = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb1; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $sqladd = mysqli_query($conn,"update tbl_category set name='$categoryname', image='$InsertImage1', thumb='$InsertImagethumb1', url='$url', order_number='$order', metakeyword='$metakeyword', metadescription='$metadescription', status='1' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { // echo "1"; echo "<script>window.location.href='../category-list.php?m=4';</script>"; exit; } else { // echo "0"; echo "<script>window.location.href='../category-list.php?m=5';</script>"; exit; } } /*--------Edit Category close-----------------------------------------------*/ /*--------Add Sub Category-----------------------------------------------*/ function addSubCategory($conn) { $category = mysqli_real_escape_string($conn,$_POST['selcategory']); $subcategoryname = mysqli_real_escape_string($conn,$_POST['txtname']); $order = mysqli_real_escape_string($conn,$_POST['txtorder']); $url = mysqli_real_escape_string($conn,$_POST['txturl']); $metakeyword = mysqli_real_escape_string($conn,$_POST['txtmetakeyword']); $metadescription = mysqli_real_escape_string($conn,$_POST['txtmetadescription']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //---------------------condition--check dots------------------------ $dots=substr_count($imagefleimagename1, '.'); if($dots>1){header('Location: ../sub-category.php?m=2&n=Rooms Image');exit(0);} //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $subcategoryPath; global $subcategoryPathThumb; $ImagePath = "$subcategoryPath/"; $ImageThumbPath = "$subcategoryPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../sub-category.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$newfile1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $imageThumbName = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $imageThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 1 end------------//////////// }else{ $newfile1=""; $imageThumbName=""; } $sql="insert into tbl_subcategory(category_id,name,image,thumb,url,order_number,status,metakeyword,metadescription) values('$category','$subcategoryname','$newfile1','$imageThumbName','$url','$order','1','$metakeyword','$metadescription')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { echo "<script>window.location.href='../sub-category-list.php?&m=1';</script>"; exit; } else { echo "<script>window.location.href='../sub-category-list.php?&m=0';</script>"; exit; } } /*--------Add Sub Category close-----------------------------------------------*/ /*--------Delete Sub Category -----------------------------------------------*/ function deleteSubCategory($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_subcategory where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { echo "<script>window.location.href='../sub-category-list.php?&m=6';</script>"; exit; } else { echo "<script>window.location.href='../sub-category-list.php?&m=7';</script>"; exit; } } /*--------Delete Sub Category close-----------------------------------------------*/ /*--------Edit Sub Category close-----------------------------------------------*/ function editSubCategory($conn) { $id = $_POST['txtid']; $category = mysqli_real_escape_string($conn,$_POST['selcategory']); $subcategoryname = mysqli_real_escape_string($conn,$_POST['txtname']); $order = mysqli_real_escape_string($conn,$_POST['txtorder']); $url = mysqli_real_escape_string($conn,$_POST['txturl']); $metakeyword = mysqli_real_escape_string($conn,$_POST['txtmetakeyword']); $metadescription = mysqli_real_escape_string($conn,$_POST['txtmetadescription']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn,"select * from tbl_subcategory where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 =0; $flagImage2 =0; // ------------- get all images name ------------------------- $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $subcategoryPath; global $subcategoryPathThumb; $ImagePath = "$subcategoryPath/"; $ImageThumbPath = "$subcategoryPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ $flagImage1 =1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../sub-category-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$InsertImage1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb1 = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb1; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $sqladd = mysqli_query($conn,"update tbl_subcategory set category_id='$category', name='$subcategoryname', image='$InsertImage1', thumb='$InsertImagethumb1', order_number='$order', metakeyword='$metakeyword', metadescription='$metadescription' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { echo "<script>window.location.href='../sub-category-list.php?&m=4';</script>"; exit; } else { echo "<script>window.location.href='../sub-category-list.php?&m=5';</script>"; exit; } } /*--------Edit Sub Category close-----------------------------------------------*/ /*--------Add product-----------------------------------------------*/ function addProduct($conn) { $category = mysqli_real_escape_string($conn,$_POST['selcategory']); $subcategory = mysqli_real_escape_string($conn,$_POST['selsubcategory']); $subsubcategory = mysqli_real_escape_string($conn,$_POST['selsubsubcategory']); $color = mysqli_real_escape_string($conn,$_POST['selcolor']); $name = mysqli_real_escape_string($conn,$_POST['txtproductname']); $url = strtolower(str_replace(" ","-",$name)); $url = strtolower(str_replace("&","and",$url)); $tax = mysqli_real_escape_string($conn,$_POST['txttax']); $shortdescription = mysqli_real_escape_string($conn,$_POST['txtshortdescription']); $skucode = mysqli_real_escape_string($conn,$_POST['txtskucode']); $rand=rand(100000,999999); $productId="SH".$rand; $date=date('d/m/Y H:i', time()); $rand2=rand(100000,999999); $varientId="SHV".$rand2; if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} if(isset($_POST['txtfeatured'])){$featured=1;}else{$featured=0;} if(isset($_POST['txtlatests'])){$latest=1;}else{$latest=0;} if(isset($_POST['txtproductpage'])){$productpage=1;}else{$productpage=0;} /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; $imagefleimagename2 = $_FILES['image2fleimage']['name']; $imagefleimagename2_tmp = $_FILES['image2fleimage']['tmp_name']; $imagefleimagename3 = $_FILES['image3fleimage']['name']; $imagefleimagename3_tmp = $_FILES['image3fleimage']['tmp_name']; $imagefleimagename4 = $_FILES['image4fleimage']['name']; $imagefleimagename4_tmp = $_FILES['image4fleimage']['tmp_name']; $imagefleimagename5 = $_FILES['image5fleimage']['name']; $imagefleimagename5_tmp = $_FILES['image5fleimage']['tmp_name']; $imagefleimagename6 = $_FILES['image6fleimage']['name']; $imagefleimagename6_tmp = $_FILES['image6fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots=substr_count($imagefleimagename1, '.'); if($dots>1){header('Location: ../product.php?m=2&n=Rooms Image');exit(0);} //------------------------------------------------------------------ //-----------------------check compalsory image------------------------------------------- /*if($imagefleimagename1==""){ header('Location: ../add-image.php?m=3&n=Product Image&id='.$productID);exit(0); } //---------------------------------------------------------------------------------------- //-----------------------check compalsory image size-------------------------------------- list($width1,$height1)=getimagesize($imagefleimagename1_tmp); if($width1<1000){ header('Location: ../add-image.php?m=13&n=1000px Product Image&id=');exit(0); } //----------------------------------------------------------------------------------------*/ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $productPath; global $productPathThumb; $ImagePath = "$productPath/"; $ImageThumbPath = "$productPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../product.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$newfile1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $imageThumbName = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $imageThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 1 end------------//////////// }else{ $newfile1=""; $imageThumbName=""; } //================================ Image 2 ============================== if( $imagefleimagename2!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename2; $uploadedfile = $imagefleimagename2; $imagefleimagename2 = stripslashes($imagefleimagename2); $extension = getExtension($imagefleimagename2); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../product.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename2_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename2_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile2=$no.$imagefleimagename2; move_uploaded_file($_FILES["image2fleimage"]['tmp_name'], "$ImagePath".$newfile2); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $image2ThumbName = $tno.$imagefleimagename2; $imagefleimagename = "$ImageThumbPath/". $image2ThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 2 end------------//////////// }else{ $newfile2=""; $image2ThumbName=""; } //================================ Image 3 ============================== if( $imagefleimagename3!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename3; $uploadedfile = $imagefleimagename3; $imagefleimagename3 = stripslashes($imagefleimagename3); $extension = getExtension($imagefleimagename3); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../product.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename3_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename3_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile3=$no.$imagefleimagename3; move_uploaded_file($_FILES["image3fleimage"]['tmp_name'], "$ImagePath".$newfile3); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $image3ThumbName = $tno.$imagefleimagename3; $imagefleimagename = "$ImageThumbPath/". $image3ThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 3 end------------//////////// }else{ $newfile3=""; $image3ThumbName=""; } //================================ Image 4 ============================== if( $imagefleimagename4!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename4; $uploadedfile = $imagefleimagename4; $imagefleimagename4 = stripslashes($imagefleimagename4); $extension = getExtension($imagefleimagename4); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../product.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename4_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename4_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile4=$no.$imagefleimagename4; move_uploaded_file($_FILES["image4fleimage"]['tmp_name'], "$ImagePath".$newfile4); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $image4ThumbName = $tno.$imagefleimagename4; $imagefleimagename = "$ImageThumbPath/". $image4ThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 4 end------------//////////// }else{ $newfile4=""; $image4ThumbName=""; } //================================ Image 5 ============================== if( $imagefleimagename5!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename5; $uploadedfile = $imagefleimagename5; $imagefleimagename5 = stripslashes($imagefleimagename5); $extension = getExtension($imagefleimagename5); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../product.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename5_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename5_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile5=$no.$imagefleimagename5; move_uploaded_file($_FILES["image5fleimage"]['tmp_name'], "$ImagePath".$newfile5); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $image5ThumbName = $tno.$imagefleimagename5; $imagefleimagename = "$ImageThumbPath/". $image5ThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 5 end------------//////////// }else{ $newfile5=""; $image5ThumbName=""; } //================================ Image 6 ============================== if( $imagefleimagename6!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename6; $uploadedfile = $imagefleimagename6; $imagefleimagename6 = stripslashes($imagefleimagename6); $extension = getExtension($imagefleimagename6); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../product.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename6_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename6_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile6=$no.$imagefleimagename6; move_uploaded_file($_FILES["image6fleimage"]['tmp_name'], "$ImagePath".$newfile6); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $image6ThumbName = $tno.$imagefleimagename6; $imagefleimagename = "$ImageThumbPath/". $image6ThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 6 end------------//////////// }else{ $newfile6=""; $image6ThumbName=""; } // insert in product $sql="insert into tbl_product(category_id,sub_category_id,sub_sub_category_id,productname,productid,varient_id,url,skucode,short_description,image1,thumb1,image2,thumb2,image3,thumb3,image4,thumb4,image5,thumb5,image6,thumb6,status,featured,latest,productpage,productDate,color,tax) values('$category','$subcategory','$subsubcategory','$name','$productId','$varientId','$url','$skucode','$shortdescription','$newfile1','$imageThumbName','$newfile2','$image2ThumbName','$newfile3','$image3ThumbName','$newfile4','$image4ThumbName','$newfile5','$image5ThumbName','$newfile6','$image6ThumbName','$status','$featured','$latest','$productpage','$date','$color','$tax')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { // $del=mysqli_query($conn,"delete from tbl_product_price where weight='0'"); // $del=mysqli_query($conn,"delete from tbl_product_stock where weight='0'"); // header('Location: ../product-list.php?m=1'); // echo "suucess"; // insert in price for($i=0;$i<=8;$i++) { $size[$i] = mysqli_real_escape_string($conn,$_POST['size'][$i]); $unit[$i] = mysqli_real_escape_string($conn,$_POST['unit'][$i]); $price[$i] = mysqli_real_escape_string($conn,$_POST['price'][$i]); $mrp[$i] = mysqli_real_escape_string($conn,$_POST['listprice'][$i]); $stock[$i] = mysqli_real_escape_string($conn,$_POST['stock'][$i]); if($price[$i]!='') { $query=mysqli_query($conn,"insert into tbl_product_price (productId,varient_id,psize,punit,pprice,pmrp,pdate,status,pqty) values ('$productId','$varientId','$size[$i]','$unit[$i]','$price[$i]','$mrp[$i]','$date','$status','$stock[$i]')"); $del=mysqli_query($conn,"delete from tbl_product_price where pprice='0' or pprice=''"); // $del=mysqli_query($conn,"delete from tbl_product_stock where weight='0' or weight=''"); header('Location: ../product-list.php?m=1'); } } } else { //echo "fail"; header('Location: ../product-list.php?m=0'); } } /*--------Add product close-----------------------------------------------*/ /*--------Delete Product -----------------------------------------------*/ function deleteProduct($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $sql=mysqli_query($conn,"select * from tbl_product where id='$id'")or die(mysqli_error($conn)); $row1=mysqli_fetch_assoc($sql); $productid=$row1['productid']; if($sql>0) { $del = mysqli_query($conn,"delete from tbl_product_price where productId = '$productid'"); $del2 = "delete from tbl_product where productid = '$productid' "; if(mysqli_query($conn,$del2) or die(mysqli_error($conn))) { header('Location: ../product-list.php?&m=6'); } else { header('Location: ../product-list.php?m=7'); } } else { header('Location: ../product-list.php?m=7'); } } /*--------Delete Product close-----------------------------------------------*/ /*--------Edit Product -----------------------------------------------*/ function editProduct($conn) { $id = $_POST['txtid']; $txtproductid = $_POST['txtproductid']; $txtvarientid = $_POST['txtvarientid']; $category = mysqli_real_escape_string($conn,$_POST['selcategory']); $subcategory = mysqli_real_escape_string($conn,$_POST['selsubcategory']); $subsubcategory = mysqli_real_escape_string($conn,$_POST['selsubsubcategory']); $color = mysqli_real_escape_string($conn,$_POST['selcolor']); $name = mysqli_real_escape_string($conn,$_POST['txtproductname']); $url = strtolower(str_replace(" ","-",$name)); $url = strtolower(str_replace("&","and",$url)); $tax = mysqli_real_escape_string($conn,$_POST['txttax']); $shortdescription = mysqli_real_escape_string($conn,$_POST['txtshortdescription']); $skucode = mysqli_real_escape_string($conn,$_POST['txtskucode']); $date=date('d/m/Y H:i', time()); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} if(isset($_POST['txtfeatured'])){$featured=1;}else{$featured=0;} if(isset($_POST['txtlatests'])){$latest=1;}else{$latest=0;} if(isset($_POST['txtproductpage'])){$productpage=1;}else{$productpage=0;} /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; $imagefleimagename2 = $_FILES['image2fleimage']['name']; $imagefleimagename2_tmp = $_FILES['image2fleimage']['tmp_name']; $imagefleimagename3 = $_FILES['image3fleimage']['name']; $imagefleimagename3_tmp = $_FILES['image3fleimage']['tmp_name']; $imagefleimagename4 = $_FILES['image4fleimage']['name']; $imagefleimagename4_tmp = $_FILES['image4fleimage']['tmp_name']; $imagefleimagename5 = $_FILES['image5fleimage']['name']; $imagefleimagename5_tmp = $_FILES['image5fleimage']['tmp_name']; $imagefleimagename6 = $_FILES['image6fleimage']['name']; $imagefleimagename6_tmp = $_FILES['image6fleimage']['tmp_name']; //------------------brand img 1-------------------------- //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn,"select * from tbl_product where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image1']; $Un_Image1 = $row['thumb1']; $Un_OrginalImage2 = $row['image2']; $Un_Image2 = $row['thumb2']; $Un_OrginalImage3 = $row['image3']; $Un_Image3 = $row['thumb3']; $Un_OrginalImage4 = $row['image4']; $Un_Image4 = $row['thumb4']; $Un_OrginalImage5 = $row['image5']; $Un_Image5 = $row['thumb5']; $Un_OrginalImage6 = $row['image6']; $Un_Image6 = $row['thumb6']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image1']; $InsertImagethumb1 = $row['thumb1']; $InsertImage2 = $row['image2']; $InsertImagethumb2 = $row['thumb2']; $InsertImage3 = $row['image3']; $InsertImagethumb3 = $row['thumb3']; $InsertImage4 = $row['image4']; $InsertImagethumb4 = $row['thumb4']; $InsertImage5 = $row['image5']; $InsertImagethumb5 = $row['thumb5']; $InsertImage6 = $row['image6']; $InsertImagethumb6 = $row['thumb6']; /*---------------------------*/ $flagImage1 =0; $flagImage2 =0; $flagImage3 =0; $flagImage4 =0; $flagImage5 =0; $flagImage6 =0; // ------------- get all images name ------------------------- $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $productPath; global $productPathThumb; $ImagePath = "$productPath/"; $ImageThumbPath = "$productPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ $flagImage1 =1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$InsertImage1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb1 = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb1; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } // ======================= image 2 ========================= if( $imagefleimagename2!=""){ $flagImage2 =2; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename2; $uploadedfile = $imagefleimagename2; $imagefleimagename2 = stripslashes($imagefleimagename2); $extension = getExtension($imagefleimagename2); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename2_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename2_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage2=$no.$imagefleimagename2; move_uploaded_file($_FILES["image2fleimage"]['tmp_name'], "$ImagePath".$InsertImage2); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb2 = $tno.$imagefleimagename2; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb2; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 2 End============================== /*----------------------------------------------*/ // ======================= image 3 ========================= if( $imagefleimagename3!=""){ $flagImage3 =3; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename3; $uploadedfile = $imagefleimagename3; $imagefleimagename3 = stripslashes($imagefleimagename3); $extension = getExtension($imagefleimagename3); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename3_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename3_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage3=$no.$imagefleimagename3; move_uploaded_file($_FILES["image3fleimage"]['tmp_name'], "$ImagePath".$InsertImage3); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb3 = $tno.$imagefleimagename3; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb3; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 3 End============================== // ======================= image 4 ========================= if( $imagefleimagename4!=""){ $flagImage4 =4; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename4; $uploadedfile = $imagefleimagename4; $imagefleimagename4 = stripslashes($imagefleimagename4); $extension = getExtension($imagefleimagename4); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename4_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename4_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage4=$no.$imagefleimagename4; move_uploaded_file($_FILES["image4fleimage"]['tmp_name'], "$ImagePath".$InsertImage4); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb4 = $tno.$imagefleimagename4; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb4; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 4 End============================== // ======================= image 5 ========================= if( $imagefleimagename5!=""){ $flagImage5 =5; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename5; $uploadedfile = $imagefleimagename5; $imagefleimagename5 = stripslashes($imagefleimagename5); $extension = getExtension($imagefleimagename5); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename5_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename5_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage5=$no.$imagefleimagename5; move_uploaded_file($_FILES["image5fleimage"]['tmp_name'], "$ImagePath".$InsertImage5); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb5 = $tno.$imagefleimagename5; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb5; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 5 End============================== // ======================= image 6 ========================= if( $imagefleimagename6!=""){ $flagImage6 =6; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename6; $uploadedfile = $imagefleimagename6; $imagefleimagename6 = stripslashes($imagefleimagename6); $extension = getExtension($imagefleimagename6); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename6_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename6_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage6=$no.$imagefleimagename6; move_uploaded_file($_FILES["image6fleimage"]['tmp_name'], "$ImagePath".$InsertImage6); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb6 = $tno.$imagefleimagename6; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb6; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 6 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn,"update tbl_product set category_id='$category', sub_category_id='$subcategory', sub_sub_category_id='$subsubcategory', productname='$name', url='$url', skucode='$skucode', short_description='$shortdescription', image1='$InsertImage1', thumb1='$InsertImagethumb1', image2='$InsertImage2', thumb2='$InsertImagethumb2', image3='$InsertImage3', thumb3='$InsertImagethumb3', image4='$InsertImage4', thumb4='$InsertImagethumb4', image5='$InsertImage5', thumb5='$InsertImagethumb5', image6='$InsertImage6', thumb6='$InsertImagethumb6', status='$status', featured='$featured', latest='$latest', productpage='$productpage', color='$color', tax='$tax' where id = '$id'") or die(mysqli_error($conn)); // Delete product price and stock //$del= mysqli_query($conn,"delete from tbl_product_stock where productId = '$txtproductid'"); $del = mysqli_query($conn,"delete from tbl_product_price where productId = '$txtproductid'"); // Delete product price and stock close if(mysqli_affected_rows($conn) > 0) { if($flagImage1==1){ if($Un_OrginalImage1!=""){ unlink($ImagePath.$Un_OrginalImage1); unlink($ImageThumbPath.$Un_Image1); } } if($flagImage2==2){ if($Un_OrginalImage2!=""){ unlink($ImagePath.$Un_OrginalImage2); unlink($ImageThumbPath.$Un_Image2); } } if($flagImage3==3){ if($Un_OrginalImage3!=""){ unlink($ImagePath.$Un_OrginalImage3); unlink($ImageThumbPath.$Un_Image3); } } if($flagImage4==4){ if($Un_OrginalImage4!=""){ unlink($ImagePath.$Un_OrginalImage4); unlink($ImageThumbPath.$Un_Image4); } } if($flagImage5==5){ if($Un_OrginalImage5!=""){ unlink($ImagePath.$Un_OrginalImage5); unlink($ImageThumbPath.$Un_Image5); } } if($flagImage6==6){ if($Un_OrginalImage6!=""){ unlink($ImagePath.$Un_OrginalImage6); unlink($ImageThumbPath.$Un_Image6); } } // insert in price for($i=0;$i<=8;$i++) { $size[$i] = mysqli_real_escape_string($conn,$_POST['size'][$i]); $unit[$i] = mysqli_real_escape_string($conn,$_POST['unit'][$i]); $price[$i] = mysqli_real_escape_string($conn,$_POST['price'][$i]); $mrp[$i] = mysqli_real_escape_string($conn,$_POST['listprice'][$i]); $stock[$i] = mysqli_real_escape_string($conn,$_POST['stock'][$i]); $query99=mysqli_query($conn,"insert into tbl_product_price (productId,varient_id,psize,punit,pprice,pmrp,pdate,status,pqty) values ('$txtproductid','$txtvarientid','$size[$i]','$unit[$i]','$price[$i]','$mrp[$i]','$date','$status','$stock[$i]')"); $del=mysqli_query($conn,"delete from tbl_product_price where pprice='0' or pprice=''"); // header('Location: ../cartupdate.php?id='.$id); // echo "success"; header('Location: ../product-list.php?m=4'); } // header('Location: ../product-list.php?m=4'); } else { header('Location: ../product-list.php?m=5'); } } /*--------Add Gallery-----------------------------------------------*/ function addGallery($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //---------------------condition--check dots------------------------ $dots=substr_count($imagefleimagename1, '.'); if($dots>1){header('Location: ../gallery.php?m=2&n=Rooms Image');exit(0);} //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $galleryPath; global $galleryPathThumb; $ImagePath = "$galleryPath/"; $ImageThumbPath = "$galleryPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../category.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$newfile1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $imageThumbName = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $imageThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 1 end------------//////////// }else{ $newfile1=""; $imageThumbName=""; } $sql="insert into tbl_gallery(name,image,thumb,status) values('$name','$newfile1','$imageThumbName','$status')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('Location: ../gallery-list.php?m=1'); //echo "success"; } else { header('Location: ../gallery-list.php?m=0'); //echo "fail"; } } /*--------Add Gallery close-----------------------------------------------*/ /*--------Delete Gallery -----------------------------------------------*/ function deleteGallery($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_gallery where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../gallery-list.php?&m=6'); } else { header('Location: ../gallery-list.php?m=7'); } } /*--------Delete Gallery close-----------------------------------------------*/ /*--------Edit Gallery close-----------------------------------------------*/ function editGallery($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn,"select * from tbl_gallery where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 =0; $flagImage2 =0; // ------------- get all images name ------------------------- $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $galleryPath; global $galleryPathThumb; $ImagePath = "$galleryPath/"; $ImageThumbPath = "$galleryPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ $flagImage1 =1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../category-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$InsertImage1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb1 = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb1; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $sqladd = mysqli_query($conn,"update tbl_gallery set name='$name', image='$InsertImage1', thumb='$InsertImagethumb1', status='$status' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { // echo "1"; header('Location: ../gallery-list.php?m=4'); } else { // echo "0"; header('Location: ../gallery-list.php?m=5'); } } /*--------Edit Gallery close-----------------------------------------------*/ /*--------Add Blogs-----------------------------------------------*/ function addBlog($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); $url = mysqli_real_escape_string($conn,$_POST['txturl']); $metakeyword = mysqli_real_escape_string($conn,$_POST['txtmetakeyword']); $metadescription = mysqli_real_escape_string($conn,$_POST['txtmetadescription']); $order_number = mysqli_real_escape_string($conn,$_POST['txtorder']); $shortdescription = mysqli_real_escape_string($conn,$_POST['txtshortdescription']); date_default_timezone_set("Asia/Kolkata"); $date=date("d-m-Y"); $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //---------------------condition--check dots------------------------ $dots=substr_count($imagefleimagename1, '.'); if($dots>1){header('Location: ../blog.php?m=2&n=Rooms Image');exit(0);} //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $blogPath; global $blogPathThumb; $ImagePath = "$blogPath/"; $ImageThumbPath = "$blogPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../blog.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$newfile1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $imageThumbName = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $imageThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 1 end------------//////////// }else{ $newfile1=""; $imageThumbName=""; } $sql="insert into tbl_blog(name,url,metakeyword,metadescription,description,image,thumb,order_number,status,date) values('$name','$url','$metakeyword','$metadescription','$shortdescription','$newfile1','$imageThumbName','$order_number','1','$date')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('Location: ../blog-list.php?m=1'); //echo "success"; } else { header('Location: ../blog-list.php?m=0'); //echo "fail"; } } /*--------Add Blog close-----------------------------------------------*/ /*--------Delete Blog -----------------------------------------------*/ function deleteBlog($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_blog where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../blog-list.php?&m=6'); } else { header('Location: ../blog-list.php?m=7'); } } /*--------Delete Blog close-----------------------------------------------*/ /*--------Edit Blog close-----------------------------------------------*/ function editBlog($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); $url = mysqli_real_escape_string($conn,$_POST['txturl']); $metakeyword = mysqli_real_escape_string($conn,$_POST['txtmetakeyword']); $metadescription = mysqli_real_escape_string($conn,$_POST['txtmetadescription']); $order_number = mysqli_real_escape_string($conn,$_POST['txtorder']); $shortdescription = mysqli_real_escape_string($conn,$_POST['txtshortdescription']); $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn,"select * from tbl_blog where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 =0; $flagImage2 =0; // ------------- get all images name ------------------------- $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $blogPath; global $blogPathThumb; $ImagePath = "$blogPath/"; $ImageThumbPath = "$blogPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ $flagImage1 =1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../blog-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$InsertImage1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb1 = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb1; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $sqladd = mysqli_query($conn,"update tbl_blog set name='$name', description='$shortdescription', metakeyword='$metakeyword', metadescription='$metadescription', url='$url', order_number='$order_number', image='$InsertImage1', thumb='$InsertImagethumb1', status='1' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { // echo "1"; header('Location: ../blog-list.php?m=4'); } else { // echo "0"; header('Location: ../blog-list.php?m=5'); } } /*--------Edit Blog close-----------------------------------------------*/ /*--------Delete ContactEnquiry -----------------------------------------------*/ function deleteContactEnquiry($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_contact where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../contact-enquiry-list.php?&m=6'); } else { header('Location: ../contact-enquiry-list.php?m=7'); } } /*--------Delete ContactEnquiry close-----------------------------------------------*/ /*--------Delete Suggestions -----------------------------------------------*/ function deleteSuggestion($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_suggestion where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../suggestion-list.php?&m=6'); } else { header('Location: ../suggestion-list.php?m=7'); } } /*--------Delete suggestion list close-----------------------------------------------*/ /*--------Add Offer-----------------------------------------------*/ function addOffer($conn) { $name = mysqli_real_escape_string($conn,$_POST['txtname']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //---------------------condition--check dots------------------------ $dots=substr_count($imagefleimagename1, '.'); if($dots>1){header('Location: ../offer.php?m=2&n=Rooms Image');exit(0);} //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $offerPath; global $offerPathThumb; $ImagePath = "$offerPath/"; $ImageThumbPath = "$offerPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../offer.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$newfile1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $imageThumbName = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $imageThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 1 end------------//////////// }else{ $newfile1=""; $imageThumbName=""; } $sql="insert into tbl_offer(name,image,thumb,status) values('$name','$newfile1','$imageThumbName','$status')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('Location: ../offer-list.php?m=1'); //echo "success"; } else { header('Location: ../offer-list.php?m=0'); //echo "fail"; } } /*--------Add Offer close-----------------------------------------------*/ /*--------Delete Offer -----------------------------------------------*/ function deleteOffer($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_offer where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../offer-list.php?&m=6'); } else { header('Location: ../offer-list.php?m=7'); } } /*--------Delete Offer close-----------------------------------------------*/ /*--------Edit Banner close-----------------------------------------------*/ function editOffer($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['txtname']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn,"select * from tbl_offer where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 =0; $flagImage2 =0; // ------------- get all images name ------------------------- $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $offerPath; global $offerPathThumb; $ImagePath = "$offerPath/"; $ImageThumbPath = "$offerPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ $flagImage1 =1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../banner-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$InsertImage1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb1 = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb1; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $sqladd = mysqli_query($conn,"update tbl_offer set name='$name', image='$InsertImage1', thumb='$InsertImagethumb1', status='$status' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { // echo "1"; header('Location: ../offer-list.php?m=4'); } else { // echo "0"; header('Location: ../offer-list.php?m=5'); } } /*--------Edit offer close-----------------------------------------------*/ /*--------Delete Order offer -----------------------------------------------*/ function deleteOrder($conn) { $orderid =isset($_GET['orderid'])? $_GET['orderid'] : ""; //echo "value is ".$id; $del = "delete from order_master where orderId = '$orderid'"; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../order-list.php?&m=6'); } else { header('Location: ../order-list.php?m=7'); } } /*--------Delete order close-----------------------------------------------*/ /*--------Add Promo code-----------------------------------------------*/ function addPromocode($conn) { $couponcode = mysqli_real_escape_string($conn,$_POST['txtcouponcode']); $couponvalue = mysqli_real_escape_string($conn,$_POST['txtcouponvalue']); $mincartvalue = mysqli_real_escape_string($conn,$_POST['txtmincartvalue']); $short_description = mysqli_real_escape_string($conn,$_POST['txtshortdescription']); $date=date('d/m/Y H:i', time()); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $sql="insert into tbl_coupon_master(coupon_code,coupon_value,short_description,date,cart_min_value,status) values('$couponcode','$couponvalue','$short_description','$date','$mincartvalue','$status')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('Location: ../promocode-list.php?m=1'); //echo "success"; } else { header('Location: ../promocode-list.php?m=0'); //echo "fail"; } } /*--------Add promocode close-----------------------------------------------*/ /*--------Delete deletePromocode -----------------------------------------------*/ function deletePromocode($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_coupon_master where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../promocode-list.php?&m=6'); } else { header('Location: ../promocode-list.php?m=7'); } } /*--------promocode.php close-----------------------------------------------*/ /*--------Edit editPromocode-----------------------------------------------*/ function editPromocode($conn) { $id = $_POST['txtid']; $couponcode = mysqli_real_escape_string($conn,$_POST['txtcouponcode']); $couponvalue = mysqli_real_escape_string($conn,$_POST['txtcouponvalue']); $mincartvalue = mysqli_real_escape_string($conn,$_POST['txtmincartvalue']); $short_description = mysqli_real_escape_string($conn,$_POST['txtshortdescription']); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} $sqladd = mysqli_query($conn,"update tbl_coupon_master set coupon_code='$couponcode', coupon_value='$couponvalue', short_description='$short_description', cart_min_value='$mincartvalue', status='$status' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { // echo "1"; header('Location: ../promocode-list.php?m=4'); } else { // echo "0"; header('Location: ../promocode-list.php?m=5'); } } /*--------Edit promocode close-----------------------------------------------*/ /*--------Delete promocode user -----------------------------------------------*/ function deletePromoCodeUser($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_coupon_user where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../promocode-user-list.php?&m=6'); } else { header('Location: ../promocode-user-list.php?m=7'); } } /*--------Delete promocode user close-----------------------------------------------*/ /*--------Delete Review -----------------------------------------------*/ function DeleteReview($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_review where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../review-list.php?&m=6'); } else { header('Location: ../review-list.php?m=7'); } } /*--------Delete Review list close-----------------------------------------------*/ /*--------Active Review -----------------------------------------------*/ function ActiveReview($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "update tbl_review set active_status='1' where id = '$id'"; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../review-list.php?&m=6'); } else { header('Location: ../review-list.php?m=7'); } } /*--------Active Review close-----------------------------------------------*/ /*--------Deactive Review -----------------------------------------------*/ function DeactiveReview($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "update tbl_review set active_status='0' where id = '$id'"; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../review-list.php?&m=6'); } else { header('Location: ../review-list.php?m=7'); } } /*--------Deactive Review close-----------------------------------------------*/ /*--------Add Invoice-----------------------------------------------*/ function addInvoice($conn) { $name = mysqli_real_escape_string($conn,$_POST['selvendor']); $plan = mysqli_real_escape_string($conn,$_POST['selplan']); $beforeamount = mysqli_real_escape_string($conn,$_POST['txtbeforeamount']); $afteramount = mysqli_real_escape_string($conn,$_POST['txtafteramount']); $discount = mysqli_real_escape_string($conn,$_POST['txtdiscount']); $startdate = mysqli_real_escape_string($conn,$_POST['txtstartdate']); $enddate = mysqli_real_escape_string($conn,$_POST['txtenddate']); $paymentmode = mysqli_real_escape_string($conn,$_POST['paymentmode']); $rand=rand(100000,999999); $tempinvoiceid="TEMP".$rand; $date=date('d/m/Y H:i', time()); $rand2=rand(100000,999999); $invoice_number="HYMRT".$rand2; $sql="insert into tbl_invoice(temp_invoiceid,vendor_id,invoice_number,status,paymentmode,startdate,enddate,plan,beforeamount,invoice_date,afteramount,discount) values('$tempinvoiceid','$name','$invoice_number','1','$paymentmode','$startdate','$enddate','$plan','$beforeamount','$date','$afteramount','$discount')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { header('Location: ../invoice-list.php?m=1'); //echo "success"; } else { header('Location: ../invoice-list.php?m=0'); //echo "fail"; } } /*--------Add Invoice close-----------------------------------------------*/ /*--------Delete Invoice -----------------------------------------------*/ function deleteInvoice($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; //echo "value is ".$id; $del = "delete from tbl_invoice where id = '$id' "; if(mysqli_query($conn,$del) or die(mysqli_error($conn))) { header('Location: ../invoice-list.php?&m=6'); } else { header('Location: ../invoice-list.php?m=7'); } } /*--------Delete Invoice close-----------------------------------------------*/ /*--------Edit Invoice close-----------------------------------------------*/ function editInvoice($conn) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn,$_POST['selvendor']); $plan = mysqli_real_escape_string($conn,$_POST['selplan']); $beforeamount = mysqli_real_escape_string($conn,$_POST['txtbeforeamount']); $afteramount = mysqli_real_escape_string($conn,$_POST['txtafteramount']); $discount = mysqli_real_escape_string($conn,$_POST['txtdiscount']); $startdate = mysqli_real_escape_string($conn,$_POST['txtstartdate']); $enddate = mysqli_real_escape_string($conn,$_POST['txtenddate']); $paymentmode = mysqli_real_escape_string($conn,$_POST['paymentmode']); $sqladd = mysqli_query($conn,"update tbl_invoice set vendor_id='$name', plan='$plan', beforeamount='$beforeamount', afteramount='$afteramount', discount='$discount', startdate='$startdate', enddate='$enddate', paymentmode='$paymentmode' where id = '$id'") or die(mysqli_error($conn)); if(mysqli_affected_rows($conn) > 0) { header('Location: ../invoice-list.php?m=4'); } else { // echo "0"; header('Location: ../invoice-list.php?m=5'); } } /*--------Edit Invoice close-----------------------------------------------*/ /*--------Add product Varient-----------------------------------------------*/ function addProductVarient($conn) { $varientId = mysqli_real_escape_string($conn,$_POST['txtvarientid']); $category = mysqli_real_escape_string($conn,$_POST['selcategory']); $subcategory = mysqli_real_escape_string($conn,$_POST['selsubcategory']); $subsubcategory = mysqli_real_escape_string($conn,$_POST['selsubsubcategory']); $color = mysqli_real_escape_string($conn,$_POST['selcolor']); $name = mysqli_real_escape_string($conn,$_POST['txtproductname']); $url = strtolower(str_replace(" ","-",$name)); $url = strtolower(str_replace("&","and",$url)); $shortdescription = mysqli_real_escape_string($conn,$_POST['txtshortdescription']); $skucode = mysqli_real_escape_string($conn,$_POST['txtskucode']); $rand=rand(100000,999999); $productId="SH".$rand; $date=date('d/m/Y H:i', time()); // $rand2=rand(100000,999999); // $varientId="SHV".$rand2; if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} if(isset($_POST['txtfeatured'])){$featured=1;}else{$featured=0;} if(isset($_POST['txtlatests'])){$latest=1;}else{$latest=0;} if(isset($_POST['txtproductpage'])){$productpage=1;}else{$productpage=0;} /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; $imagefleimagename2 = $_FILES['image2fleimage']['name']; $imagefleimagename2_tmp = $_FILES['image2fleimage']['tmp_name']; $imagefleimagename3 = $_FILES['image3fleimage']['name']; $imagefleimagename3_tmp = $_FILES['image3fleimage']['tmp_name']; $imagefleimagename4 = $_FILES['image4fleimage']['name']; $imagefleimagename4_tmp = $_FILES['image4fleimage']['tmp_name']; $imagefleimagename5 = $_FILES['image5fleimage']['name']; $imagefleimagename5_tmp = $_FILES['image5fleimage']['tmp_name']; $imagefleimagename6 = $_FILES['image6fleimage']['name']; $imagefleimagename6_tmp = $_FILES['image6fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots=substr_count($imagefleimagename1, '.'); if($dots>1){header('Location: ../product.php?m=2&n=Rooms Image');exit(0);} //------------------------------------------------------------------ //-----------------------check compalsory image------------------------------------------- /*if($imagefleimagename1==""){ header('Location: ../add-image.php?m=3&n=Product Image&id='.$productID);exit(0); } //---------------------------------------------------------------------------------------- //-----------------------check compalsory image size-------------------------------------- list($width1,$height1)=getimagesize($imagefleimagename1_tmp); if($width1<1000){ header('Location: ../add-image.php?m=13&n=1000px Product Image&id=');exit(0); } //----------------------------------------------------------------------------------------*/ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $productPath; global $productPathThumb; $ImagePath = "$productPath/"; $ImageThumbPath = "$productPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../product.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$newfile1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $imageThumbName = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $imageThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 1 end------------//////////// }else{ $newfile1=""; $imageThumbName=""; } //================================ Image 2 ============================== if( $imagefleimagename2!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename2; $uploadedfile = $imagefleimagename2; $imagefleimagename2 = stripslashes($imagefleimagename2); $extension = getExtension($imagefleimagename2); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../product.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename2_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename2_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile2=$no.$imagefleimagename2; move_uploaded_file($_FILES["image2fleimage"]['tmp_name'], "$ImagePath".$newfile2); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $image2ThumbName = $tno.$imagefleimagename2; $imagefleimagename = "$ImageThumbPath/". $image2ThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 2 end------------//////////// }else{ $newfile2=""; $image2ThumbName=""; } //================================ Image 3 ============================== if( $imagefleimagename3!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename3; $uploadedfile = $imagefleimagename3; $imagefleimagename3 = stripslashes($imagefleimagename3); $extension = getExtension($imagefleimagename3); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../product.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename3_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename3_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile3=$no.$imagefleimagename3; move_uploaded_file($_FILES["image3fleimage"]['tmp_name'], "$ImagePath".$newfile3); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $image3ThumbName = $tno.$imagefleimagename3; $imagefleimagename = "$ImageThumbPath/". $image3ThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 3 end------------//////////// }else{ $newfile3=""; $image3ThumbName=""; } //================================ Image 4 ============================== if( $imagefleimagename4!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename4; $uploadedfile = $imagefleimagename4; $imagefleimagename4 = stripslashes($imagefleimagename4); $extension = getExtension($imagefleimagename4); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../product.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename4_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename4_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile4=$no.$imagefleimagename4; move_uploaded_file($_FILES["image4fleimage"]['tmp_name'], "$ImagePath".$newfile4); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $image4ThumbName = $tno.$imagefleimagename4; $imagefleimagename = "$ImageThumbPath/". $image4ThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 4 end------------//////////// }else{ $newfile4=""; $image4ThumbName=""; } //================================ Image 5 ============================== if( $imagefleimagename5!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename5; $uploadedfile = $imagefleimagename5; $imagefleimagename5 = stripslashes($imagefleimagename5); $extension = getExtension($imagefleimagename5); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../product.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename5_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename5_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile5=$no.$imagefleimagename5; move_uploaded_file($_FILES["image5fleimage"]['tmp_name'], "$ImagePath".$newfile5); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $image5ThumbName = $tno.$imagefleimagename5; $imagefleimagename = "$ImageThumbPath/". $image5ThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 5 end------------//////////// }else{ $newfile5=""; $image5ThumbName=""; } //================================ Image 6 ============================== if( $imagefleimagename6!=""){ //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename6; $uploadedfile = $imagefleimagename6; $imagefleimagename6 = stripslashes($imagefleimagename6); $extension = getExtension($imagefleimagename6); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") ) { header('Location: ../product.php?m=3'); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename6_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename6_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setheight=400; $ratio=0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } $newfile6=$no.$imagefleimagename6; move_uploaded_file($_FILES["image6fleimage"]['tmp_name'], "$ImagePath".$newfile6); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $image6ThumbName = $tno.$imagefleimagename6; $imagefleimagename = "$ImageThumbPath/". $image6ThumbName; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 6 end------------//////////// }else{ $newfile6=""; $image6ThumbName=""; } // insert in product $sql="insert into tbl_product(category_id,sub_category_id,sub_sub_category_id,productname,productid,varient_id,url,skucode,short_description,image1,thumb1,image2,thumb2,image3,thumb3,image4,thumb4,image5,thumb5,image6,thumb6,status,featured,latest,productpage,productDate,color) values('$category','$subcategory','$subsubcategory','$name','$productId','$varientId','$url','$skucode','$shortdescription','$newfile1','$imageThumbName','$newfile2','$image2ThumbName','$newfile3','$image3ThumbName','$newfile4','$image4ThumbName','$newfile5','$image5ThumbName','$newfile6','$image6ThumbName','$status','$featured','$latest','$productpage','$date','$color')"; if(mysqli_query($conn,$sql) or die(mysqli_error($conn))) { // $del=mysqli_query($conn,"delete from tbl_product_price where weight='0'"); // $del=mysqli_query($conn,"delete from tbl_product_stock where weight='0'"); // header('Location: ../product-list.php?m=1'); // echo "suucess"; // insert in price for($i=0;$i<=8;$i++) { $size[$i] = mysqli_real_escape_string($conn,$_POST['size'][$i]); $unit[$i] = mysqli_real_escape_string($conn,$_POST['unit'][$i]); $price[$i] = mysqli_real_escape_string($conn,$_POST['price'][$i]); $mrp[$i] = mysqli_real_escape_string($conn,$_POST['listprice'][$i]); $stock[$i] = mysqli_real_escape_string($conn,$_POST['stock'][$i]); if($price[$i]!='') { $query=mysqli_query($conn,"insert into tbl_product_price (productId,varient_id,psize,punit,pprice,pmrp,pdate,status,pqty) values ('$productId','$varientId','$size[$i]','$unit[$i]','$price[$i]','$mrp[$i]','$date','$status','$stock[$i]')"); $del=mysqli_query($conn,"delete from tbl_product_price where pprice='0' or pprice=''"); // $del=mysqli_query($conn,"delete from tbl_product_stock where weight='0' or weight=''"); header('Location: ../product-varient-list.php?m=1&varientid='.$varientId); } } } else { //echo "fail"; header('Location: ../product-varient-list.php?m=0&varientid='.$varientId); } } /*--------Add product Varient close-----------------------------------------------*/ /*--------Delete Product Varient -----------------------------------------------*/ function deleteProductVarient($conn) { $id =isset($_GET['id'])? $_GET['id'] : ""; $varientId =isset($_GET['varientid'])? $_GET['varientid'] : ""; //echo "value is ".$id; $sql=mysqli_query($conn,"select * from tbl_product where id='$id'")or die(mysqli_error($conn)); $row1=mysqli_fetch_assoc($sql); $productid=$row1['productid']; if($sql>0) { $del = mysqli_query($conn,"delete from tbl_product_price where productId = '$productid'"); $del2 = "delete from tbl_product where productid = '$productid' "; if(mysqli_query($conn,$del2) or die(mysqli_error($conn))) { header('Location: ../product-varient-list.php?&m=6&varientid='.$varientId); } else { header('Location: ../product-varient-list.php?m=7&varientid='.$varientId); } } else { header('Location: ../product-varient-list.php?m=7&varientid='.$varientId); } } /*--------Delete Product Varient close-----------------------------------------------*/ /*--------Edit Product Varient -----------------------------------------------*/ function editProductVarient($conn) { $id = $_POST['txtid']; $txtproductid = $_POST['txtproductid']; $varientId = mysqli_real_escape_string($conn,$_POST['txtvarientid']); $varientid = mysqli_real_escape_string($conn,$_POST['txtvarientid']); $category = mysqli_real_escape_string($conn,$_POST['selcategory']); $subcategory = mysqli_real_escape_string($conn,$_POST['selsubcategory']); $subsubcategory = mysqli_real_escape_string($conn,$_POST['selsubsubcategory']); $color = mysqli_real_escape_string($conn,$_POST['selcolor']); $name = mysqli_real_escape_string($conn,$_POST['txtproductname']); $url = strtolower(str_replace(" ","-",$name)); $url = strtolower(str_replace("&","and",$url)); $shortdescription = mysqli_real_escape_string($conn,$_POST['txtshortdescription']); $skucode = mysqli_real_escape_string($conn,$_POST['txtskucode']); $date=date('d/m/Y H:i', time()); if(isset($_POST['txtstatus'])){$status=1;}else{$status=0;} if(isset($_POST['txtfeatured'])){$featured=1;}else{$featured=0;} if(isset($_POST['txtlatests'])){$latest=1;}else{$latest=0;} if(isset($_POST['txtproductpage'])){$productpage=1;}else{$productpage=0;} /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; $imagefleimagename2 = $_FILES['image2fleimage']['name']; $imagefleimagename2_tmp = $_FILES['image2fleimage']['tmp_name']; $imagefleimagename3 = $_FILES['image3fleimage']['name']; $imagefleimagename3_tmp = $_FILES['image3fleimage']['tmp_name']; $imagefleimagename4 = $_FILES['image4fleimage']['name']; $imagefleimagename4_tmp = $_FILES['image4fleimage']['tmp_name']; $imagefleimagename5 = $_FILES['image5fleimage']['name']; $imagefleimagename5_tmp = $_FILES['image5fleimage']['tmp_name']; $imagefleimagename6 = $_FILES['image6fleimage']['name']; $imagefleimagename6_tmp = $_FILES['image6fleimage']['tmp_name']; //------------------brand img 1-------------------------- //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn,"select * from tbl_product where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image1']; $Un_Image1 = $row['thumb1']; $Un_OrginalImage2 = $row['image2']; $Un_Image2 = $row['thumb2']; $Un_OrginalImage3 = $row['image3']; $Un_Image3 = $row['thumb3']; $Un_OrginalImage4 = $row['image4']; $Un_Image4 = $row['thumb4']; $Un_OrginalImage5 = $row['image5']; $Un_Image5 = $row['thumb5']; $Un_OrginalImage6 = $row['image6']; $Un_Image6 = $row['thumb6']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image1']; $InsertImagethumb1 = $row['thumb1']; $InsertImage2 = $row['image2']; $InsertImagethumb2 = $row['thumb2']; $InsertImage3 = $row['image3']; $InsertImagethumb3 = $row['thumb3']; $InsertImage4 = $row['image4']; $InsertImagethumb4 = $row['thumb4']; $InsertImage5 = $row['image5']; $InsertImagethumb5 = $row['thumb5']; $InsertImage6 = $row['image6']; $InsertImagethumb6 = $row['thumb6']; /*---------------------------*/ $flagImage1 =0; $flagImage2 =0; $flagImage3 =0; $flagImage4 =0; $flagImage5 =0; $flagImage6 =0; // ------------- get all images name ------------------------- $no = rand(1,999); $tno = rand(1,999); ///////--------------Upload Logo Image-----------------//////////// global $productPath; global $productPathThumb; $ImagePath = "$productPath/"; $ImageThumbPath = "$productPathThumb/"; //================================ Image 1 ============================== if( $imagefleimagename1!=""){ $flagImage1 =1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage1=$no.$imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath".$InsertImage1); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb1 = $tno.$imagefleimagename1; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb1; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } // ======================= image 2 ========================= if( $imagefleimagename2!=""){ $flagImage2 =2; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename2; $uploadedfile = $imagefleimagename2; $imagefleimagename2 = stripslashes($imagefleimagename2); $extension = getExtension($imagefleimagename2); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename2_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename2_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage2=$no.$imagefleimagename2; move_uploaded_file($_FILES["image2fleimage"]['tmp_name'], "$ImagePath".$InsertImage2); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb2 = $tno.$imagefleimagename2; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb2; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 2 End============================== /*----------------------------------------------*/ // ======================= image 3 ========================= if( $imagefleimagename3!=""){ $flagImage3 =3; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename3; $uploadedfile = $imagefleimagename3; $imagefleimagename3 = stripslashes($imagefleimagename3); $extension = getExtension($imagefleimagename3); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename3_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename3_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage3=$no.$imagefleimagename3; move_uploaded_file($_FILES["image3fleimage"]['tmp_name'], "$ImagePath".$InsertImage3); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb3 = $tno.$imagefleimagename3; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb3; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 3 End============================== // ======================= image 4 ========================= if( $imagefleimagename4!=""){ $flagImage4 =4; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename4; $uploadedfile = $imagefleimagename4; $imagefleimagename4 = stripslashes($imagefleimagename4); $extension = getExtension($imagefleimagename4); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename4_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename4_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage4=$no.$imagefleimagename4; move_uploaded_file($_FILES["image4fleimage"]['tmp_name'], "$ImagePath".$InsertImage4); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb4 = $tno.$imagefleimagename4; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb4; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 4 End============================== // ======================= image 5 ========================= if( $imagefleimagename5!=""){ $flagImage5 =5; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename5; $uploadedfile = $imagefleimagename5; $imagefleimagename5 = stripslashes($imagefleimagename5); $extension = getExtension($imagefleimagename5); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename5_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename5_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage5=$no.$imagefleimagename5; move_uploaded_file($_FILES["image5fleimage"]['tmp_name'], "$ImagePath".$InsertImage5); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb5 = $tno.$imagefleimagename5; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb5; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 5 End============================== // ======================= image 6 ========================= if( $imagefleimagename6!=""){ $flagImage6 =6; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename6; $uploadedfile = $imagefleimagename6; $imagefleimagename6 = stripslashes($imagefleimagename6); $extension = getExtension($imagefleimagename6); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id='.$id); exit(); } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $imagefleimagename6_tmp; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $imagefleimagename6_tmp; $src = imagecreatefrompng($uploadedfile); }else { $src = imagecreatefromgif($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $setwidth=400; $ratio=0.0; if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage6=$no.$imagefleimagename6; move_uploaded_file($_FILES["image6fleimage"]['tmp_name'], "$ImagePath".$InsertImage6); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight, $width,$height); $InsertImagethumb6 = $tno.$imagefleimagename6; $imagefleimagename = "$ImageThumbPath/". $InsertImagethumb6; imagejpeg($tmp,$imagefleimagename,100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 6 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn,"update tbl_product set category_id='$category', sub_category_id='$subcategory', sub_sub_category_id='$subsubcategory', productname='$name', url='$url', skucode='$skucode', short_description='$shortdescription', image1='$InsertImage1', thumb1='$InsertImagethumb1', image2='$InsertImage2', thumb2='$InsertImagethumb2', image3='$InsertImage3', thumb3='$InsertImagethumb3', image4='$InsertImage4', thumb4='$InsertImagethumb4', image5='$InsertImage5', thumb5='$InsertImagethumb5', image6='$InsertImage6', thumb6='$InsertImagethumb6', status='$status', featured='$featured', latest='$latest', productpage='$productpage', color='$color' where id = '$id'") or die(mysqli_error($conn)); // Delete product price and stock //$del= mysqli_query($conn,"delete from tbl_product_stock where productId = '$txtproductid'"); $del = mysqli_query($conn,"delete from tbl_product_price where productId = '$txtproductid'"); // Delete product price and stock close if(mysqli_affected_rows($conn) > 0) { if($flagImage1==1){ if($Un_OrginalImage1!=""){ unlink($ImagePath.$Un_OrginalImage1); unlink($ImageThumbPath.$Un_Image1); } } if($flagImage2==2){ if($Un_OrginalImage2!=""){ unlink($ImagePath.$Un_OrginalImage2); unlink($ImageThumbPath.$Un_Image2); } } if($flagImage3==3){ if($Un_OrginalImage3!=""){ unlink($ImagePath.$Un_OrginalImage3); unlink($ImageThumbPath.$Un_Image3); } } if($flagImage4==4){ if($Un_OrginalImage4!=""){ unlink($ImagePath.$Un_OrginalImage4); unlink($ImageThumbPath.$Un_Image4); } } if($flagImage5==5){ if($Un_OrginalImage5!=""){ unlink($ImagePath.$Un_OrginalImage5); unlink($ImageThumbPath.$Un_Image5); } } if($flagImage6==6){ if($Un_OrginalImage6!=""){ unlink($ImagePath.$Un_OrginalImage6); unlink($ImageThumbPath.$Un_Image6); } } // insert in price for($i=0;$i<=8;$i++) { $size[$i] = mysqli_real_escape_string($conn,$_POST['size'][$i]); $unit[$i] = mysqli_real_escape_string($conn,$_POST['unit'][$i]); $price[$i] = mysqli_real_escape_string($conn,$_POST['price'][$i]); $mrp[$i] = mysqli_real_escape_string($conn,$_POST['listprice'][$i]); $stock[$i] = mysqli_real_escape_string($conn,$_POST['stock'][$i]); $query99=mysqli_query($conn,"insert into tbl_product_price (productId,varient_id,psize,punit,pprice,pmrp,pdate,status,pqty) values ('$txtproductid','$varientId','$size[$i]','$unit[$i]','$price[$i]','$mrp[$i]','$date','$status','$stock[$i]')"); $del=mysqli_query($conn,"delete from tbl_product_price where pprice='0' or pprice=''"); // header('Location: ../cartupdate.php?id='.$id); // echo "success"; header('Location: ../product-varient-list.php?m=4&varientid='.$varientId); } // header('Location: ../product-list.php?m=4'); } else { header('Location: ../product-varient-list.php?m=5&varientid='.$varientId); } } /*--------Edit Product Varient-----------------------------------------------*/ ?>