55ok

Mini

Direktori : /home/bestphotography/public_html/Admin/
Upload File :
Current File : /home/bestphotography/public_html/Admin/general-functions.php

<?php
// Initialize the session
session_start();  
include "config.php";
ob_start();
// Check if the user is logged in, if not then redirect him to login page
// if(!isset($_SESSION["login"]) && $_SESSION["login"] !== true){
// 	header("location: index.php");
//     exit;
//}
date_default_timezone_set('Asia/Kolkata');
$date = date('Y-m-d H:i:s'); 
 //$target1 = "../assets/img/blog/"; 
 //$target1 = $target1 . basename( $_FILES['blog_detail_img']['name']);			
 //$blog_detail_img=($_FILES['blog_detail_img']['name']);
 //$target2 = "../assets/img/blog/"; 
 //$target2 = $target2 . basename( $_FILES['blog_detail_img']['name']);			
 //$blog_detail_img=($_FILES['blog_detail_img']['name']);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
	if ($_POST['act'] == 'ADD_SLIDER')
	{
		if ($_POST['name'] == '') { 
			echo "You must enter all fields";
		}
		else {
			 $number_result = $conn->query('SELECT * FROM slider WHERE status=1');
			 $numrows = mysqli_num_rows($number_result);
			 if($numrows != 5){
				 $filename=$_FILES["image"]["name"];
				 $ext = pathinfo($filename, PATHINFO_EXTENSION);
				 $type = "slider";
				 $fname1 = $_POST["name"];
				 $uploading_time = date("d-m-Y H:i:s");
				 $image_name = $type.'_'.$fname1.'_'.$uploading_time.'.'.$ext;
				 $target = "../assets/img/home/slider/"; 
				 $target = $target . $image_name;			
				 $image=$image_name;
				 
				 $queryi="INSERT INTO slider(slider_id, name, image, slider_desc, status, createdon, updatedon) VALUES (NOT NULL, '".$_POST["name"]."', '".$image."', '".$_POST["slider_desc"]."', '".$_POST["status"]."', '".$date."', '".$date."')";			 
				//echo $queryi;
			 } else {
				 echo '<script type="text/javascript">alert("Your slider limit is exceeded. Kindly delete anyone of the slider");window.location.href = "./slider.php";</script>';
			 }
			 
			 
			 if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully added.");window.location.href = "./slider.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./add-slider.php";</script>';
		}
	}	
	if ($_POST['act'] == 'EDIT_SLIDER')
	{
		if ($_POST['slider_id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			$image_check1 = $_FILES['image']['name'];
			 if($image_check1==""){
				 $image = $_POST["timage"];
			 } else {
				 $filename=$_FILES["image"]["name"];
				 $ext = pathinfo($filename, PATHINFO_EXTENSION);
				 $type = "slider";
				 $fname1 = $_POST["name"];
				 $uploading_time = date("d-m-Y H:i:s");
				 $image_name = $type.'_'.$fname1.'_'.$uploading_time.'.'.$ext;
				 $target = "../assets/img/home/slider/"; 
				 $target = $target . $image_name;			
				 $image=$image_name;
			 }
			$queryi="UPDATE slider SET name='".$_POST["name"]."', image='".$image."', slider_desc='".$_POST["slider_desc"]."', status='".$_POST["status"]."', updatedon='".$date."' WHERE slider_id='".$_POST["slider_id"]."'";
			//echo $queryi;
			if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			if ($conn->query($queryi))
			{	
				echo '<script type="text/javascript">alert("Successfully Updated");window.location.href = "./slider.php";</script>';
			}
			else
				$slider_id = $_POST["slider_id"];
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./edit-slider.php?id='.$slider_id.'";</script>';
		}
	}
	if ($_POST['act'] == 'DEL_SLIDER')
	{
		if ($_POST['id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			$slider_id = $_POST['id'];
			$queryi=mysqli_query($conn, "delete from slider where slider_id='".$slider_id."'");
			
			if ($conn->query($queryi))
			{	
				$slider_result = $conn->query('SELECT image FROM slider WHERE slider_id="'.$slider_id.'"');
				$result_slider = mysqli_fetch_row($slider_result);
				$change_html_char = array("@amp" => "&", "@apos" => "'", "@hypen" => "-", "@uscore" => "_");
				$delid=strtr($result_slider[0],$change_html_char);
				unlink("../assets/img/home/slider/".$delid."");
				echo '<script type="text/javascript">alert("Successfully Deleted");window.location.href = "./slider.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./slider.php";</script>';
		}		
	}
    if ($_POST['act'] == 'ADD_CATEGORY')
	{
		if ($_POST['category_name'] == '') { 
			echo "You must enter all fields";
		}
		else {
			 $target = "../assets/img/portfolio/banner/"; 
			 $target = $target . basename( $_FILES['image']['name']);			
			 $image=($_FILES['image']['name']); 
			 
			 $target1 = "../assets/img/portfolio/banner/detail/"; 
			 $target1 = $target . basename( $_FILES['image1']['name']);			
			 $image1=($_FILES['image1']['name']); 
			 
			 $_POST["subcat_status"] == "" ? $_POST["subcat_status"] = 0 : $_POST["subcat_status"];
			 
			 $category_desc = $_POST["category_desc"];
			 $change_html_ent = array(" " => " ", "&" => "&amp;", "'" => "&apos;");
			 $desc = strtr(strtolower($category_desc), $change_html_ent);
			 
			 $subtitle = $_POST["subtitle"];
			 $change_html_ent = array(" " => " ", "&" => "&amp;", "'" => "&apos;");
			 $stitle = strtr(strtolower($subtitle), $change_html_ent);
			
			 $queryi="INSERT INTO category(category_id, category_name, subtitle, image, detail_image, category_desc, subcat_status, status, createdon, updatedon) VALUES (NOT NULL, '".$_POST["category_name"]."', '".$stitle."', '".$image."', '".$image1."', '".$desc."', '".$_POST["subcat_status"]."', '".$_POST["status"]."', '".$date."', '".$date."')";
			 if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 echo "Sorry, there was a problem uploading your file."; 
			 } 
			 if(move_uploaded_file($_FILES['image1']['tmp_name'], $target1)) 
			 {  
			 //Tells you if its all ok 
			 echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 echo "Sorry, there was a problem uploading your file."; 
			 } 
			//echo $queryi;
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully added.");window.location.href = "./category.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./add-category.php";</script>';
		}
	}	
	if ($_POST['act'] == 'EDIT_CATEGORY')
	{
		if ($_POST['category_id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			$target = "../assets/img/portfolio/banner/"; 
			$target = $target . basename( $_FILES['image']['name']);			
			$image=($_FILES['image']['name']);
			$image=="" ? $image = $_POST["timage"] : $image;
			
			$target1 = "../assets/img/portfolio/banner/detail/"; 
			$target1 = $target1 . basename( $_FILES['image1']['name']);			
			$image1=($_FILES['image1']['name']);
			$image1=="" ? $image1 = $_POST["timage1"] : $image1;
			
			$_POST["subcat_status"] == "" ? $_POST["subcat_status"] = 0 : $_POST["subcat_status"];
			
			$category_desc = $_POST["category_desc"];
			$change_html_ent = array(" " => " ", "&" => "&amp;", "'" => "&apos;");
			$desc = strtr(strtolower($category_desc), $change_html_ent);
			
			$subtitle = $_POST["subtitle"];
			$change_html_ent = array(" " => " ", "&" => "&amp;", "'" => "&apos;");
			$stitle = strtr(strtolower($subtitle), $change_html_ent);
			
			$queryi="UPDATE category SET category_name='".$_POST["category_name"]."', subtitle='".$stitle."', image='".$image."', detail_image='".$image1."', category_desc='".$desc."', subcat_status='".$_POST["subcat_status"]."', status='".$_POST["status"]."', updatedon='".$date."' WHERE category_id='".$_POST["category_id"]."'";
			//echo $queryi;
			 if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 echo "Sorry, there was a problem uploading your file."; 
			 } 
			 if(move_uploaded_file($_FILES['image1']['tmp_name'], $target1)) 
			 {  
			 //Tells you if its all ok 
			 echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 echo "Sorry, there was a problem uploading your file."; 
			 } 
			if ($conn->query($queryi))
			{	
				echo '<script type="text/javascript">alert("Successfully Updated");window.location.href = "./category.php";</script>';
			}
			else
				$category_id = $_POST["category_id"];
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./edit-category.php?id='.$category_id.'";</script>';
		}
	}
	if ($_POST['act'] == 'DEL_CATEGORY')
	{
		if ($_POST['id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			$category_id = $_POST['id'];
			$queryi=mysqli_query($conn, "delete from category where category_id='".$category_id."'");
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully Deleted");window.location.href = "./category.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./category.php";</script>';
		}		
	}
	if ($_POST['act'] == 'ADD_PAGES')
	{
		if ($_POST['page_name'] == '') { 
			echo "You must enter all fields";
		}
		else {
			 
			 $queryi="INSERT INTO pages(pid, page_name, link, status, createdon, updatedon) VALUES (NOT NULL, '".$_POST["page_name"]."', '".$_POST["link"]."', '".$_POST["status"]."', '".$date."', '".$date."')";			 
			//echo $queryi;
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully added.");window.location.href = "./pages.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./add-pages.php";</script>';
		}
	}	
	if ($_POST['act'] == 'EDIT_PAGES')
	{
		if ($_POST['pid'] == '') { 
			echo "You must choose anyone";
		}
		else {
			
			$queryi="UPDATE pages SET page_name='".$_POST["page_name"]."', link='".$_POST["link"]."', status='".$_POST["status"]."', updatedon='".$date."' WHERE pid='".$_POST["pid"]."'";
			//echo $queryi;
			 
			if ($conn->query($queryi))
			{	
				echo '<script type="text/javascript">alert("Successfully Updated");window.location.href = "./pages.php";</script>';
			}
			else
				$pid = $_POST["pid"];
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./edit-pages.php?id='.$pid.'";</script>';
		}
	}
	if ($_POST['act'] == 'DEL_PAGES')
	{
		if ($_POST['id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			$pid = $_POST['id'];
			$queryi=mysqli_query($conn, "delete from pages where pid='".$pid."'");
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully Deleted");window.location.href = "./pages.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./pages.php";</script>';
		}		
	}
	if ($_POST['act'] == 'ADD_META_TAGS')
	{
		if ($_POST['title'] == '') { 
			echo "You must enter all fields";
		}
		else {

			 $filename=$_FILES["image"]["name"];
			 $ext = pathinfo($filename, PATHINFO_EXTENSION);
			 $type = "preview";
			 $fname1 = $_POST["title"];
			 $uploading_time = date("d-m-Y H:i:s");
			 $image_name = $type.'_'.$fname1.'_'.$uploading_time.'.'.$ext;
			 $target = "../images/meta/"; 
			 $target = $target . $image_name;			
			 $image=$image_name;
			 
			 $_POST["page_id"]=($_POST["page_id"]==''? 0:$_POST["page_id"]);
			 $queryi="INSERT INTO meta_tags(mid, title, description, keywords, og_title, og_sitename, og_url, og_desc, og_type, og_image, alt_tags, page_id, status, createdon, updatedon) VALUES (NOT NULL, '".$_POST["title"]."', '".$_POST["description"]."', '".$_POST["keywords"]."', '".$_POST["og_title"]."', '".$_POST["og_sitename"]."', '".$_POST["og_url"]."', '".$_POST["og_desc"]."', '".$_POST["og_type"]."', '".$image."', '".$_POST["alt_tags"]."', '".$_POST["page_id"]."', '".$_POST["status"]."', '".$date."', '".$date."')";	
			 
			if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			 
			 
			//echo $queryi;
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully added.");window.location.href = "./meta-tags.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./add-meta-tags.php";</script>';
			
			
		}
	}
	if ($_POST['act'] == 'EDIT_META_TAGS')
	{
		if ($_POST['mid'] == '') { 
			echo "You must choose anyone";
		}
		else {
			 $image_check1 = $_FILES['image']['name'];
			 if($image_check1==""){
				 $image = $_POST["timage"];
			 } else {
				 $filename=$_FILES["image"]["name"];
				 $ext = pathinfo($filename, PATHINFO_EXTENSION);
				 $type = "preview";
				 $fname1 = $_POST["title"];
				 $uploading_time = date("d-m-Y H:i:s");
				 $image_name = $type.'_'.$fname1.'_'.$uploading_time.'.'.$ext;
				 $target = "../images/photography/album/"; 
				 $target = $target . $image_name;			
				 $image=$image_name; 
			 }

			 
			 
			$_POST["page_id"]=($_POST["page_id"]==''? 0:$_POST["page_id"]);
			$queryi="UPDATE meta_tags SET title='".$_POST["title"]."', description='".$_POST["description"]."', keywords='".$_POST["keywords"]."', og_title='".$_POST["og_title"]."', og_url='".$_POST["og_url"]."', og_desc='".$_POST["og_desc"]."', og_type='".$_POST["og_type"]."', og_image='".$image."', alt_tags='".$_POST["alt_tags"]."', page_id='".$_POST["page_id"]."', status='".$_POST["status"]."', updatedon='".$date."' WHERE mid='".$_POST["mid"]."'";
			//echo $queryi;
			if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			 
			 
			 
			if ($conn->query($queryi))
			{	
				echo '<script type="text/javascript">alert("Successfully Updated");window.location.href = "./meta-tags.php";</script>';
			}
			else
				$mid = $_POST["mid"];
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./edit-meta-tags.php?id='.$mid.'";</script>';
		}
		
	}
	if ($_POST['act'] == 'DEL_META_TAGS')
	{
		if ($_POST['id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			$mid = $_POST['id'];
			$queryi=mysqli_query($conn, "delete from meta_tags where mid='".$mid."'");
			
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully Deleted");window.location.href = "./meta-tags.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./meta-tags.php";</script>';
		}		
	}
	if ($_POST['act'] == 'ADD_VIDEOS')
	{
		if ($_POST['title'] == '') { 
			echo "You must enter all fields";
		}
		else {
			 
			 $queryi="INSERT INTO videos(vid, date, title, tags, link, status, createdon, updatedon) VALUES (NOT NULL, '".$date."', '".$_POST["title"]."', '".$_POST["tags"]."', '".$_POST["link"]."', '".$_POST["status"]."', '".$date."', '".$date."')";			 
			//echo $queryi;
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully added.");window.location.href = "./videos.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./add-videos.php";</script>';
		}
	}	
	if ($_POST['act'] == 'EDIT_VIDEOS')
	{
		if ($_POST['vid'] == '') { 
			echo "You must choose anyone";
		}
		else {
			
			$queryi="UPDATE videos SET title='".$_POST["title"]."',  tags='".$_POST["tags"]."', link='".$_POST["link"]."', status='".$_POST["status"]."', updatedon='".$date."' WHERE vid='".$_POST["vid"]."'";
			//echo $queryi;
			 if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			if ($conn->query($queryi))
			{	
				echo '<script type="text/javascript">alert("Successfully Updated");window.location.href = "./videos.php";</script>';
			}
			else
				$vid = $_POST["vid"];
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./edit-videos.php?id='.$vid.'";</script>';
		}
	}
	if ($_POST['act'] == 'DEL_VIDEOS')
	{
		if ($_POST['id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			$vid = $_POST['id'];
			$queryi=mysqli_query($conn, "delete from videos where vid='".$vid."'");
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully Deleted");window.location.href = "./videos.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./videos.php";</script>';
		}		
	}
	if ($_POST['act'] == 'ADD_SUBCATEGORY')
	{
		if ($_POST['subcategory_name'] == '') { 
			echo "You must enter all fields";
		}
		else {
			 $target = "../assets/images/portfolio/subcategory/"; 
			 $target = $target . basename( $_FILES['image']['name']);			
			 $image=($_FILES['image']['name']); 
			 $queryi="INSERT INTO subcategory(subcategory_id, subcategory_name, image, subcategory_desc, category_id, status, createdon, updatedon) VALUES (NOT NULL, '".$_POST["subcategory_name"]."', '".$image."', '".$_POST["subcategory_desc"]."', '".$_POST["category_id"]."', '".$_POST["status"]."', '".$date."', '".$date."')";
			 if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			//echo $queryi;
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully added.");window.location.href = "./subcategory.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./add-subcategory.php";</script>';
		}
	}	
	if ($_POST['act'] == 'EDIT_SUBCATEGORY')
	{
		if ($_POST['subcategory_id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			$target = "../assets/images/portfolio/subcategory/"; 
			$target = $target . basename( $_FILES['image']['name']);			
			$image=($_FILES['image']['name']);
			$image=="" ? $image = $_POST["timage"] : $image;
			$queryi="UPDATE subcategory SET subcategory_name='".$_POST["subcategory_name"]."', image='".$image."', subcategory_desc='".$_POST["subcategory_desc"]."', category_id='".$_POST["category_id"]."', status='".$_POST["status"]."', updatedon='".$date."' WHERE subcategory_id='".$_POST["subcategory_id"]."'";
			//echo $queryi;
			 if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			if ($conn->query($queryi))
			{	
				echo '<script type="text/javascript">alert("Successfully Updated");window.location.href = "./subcategory.php";</script>';
			}
			else
				$subcategory_id = $_POST["subcategory_id"];
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./edit-subcategory.php?id='.$subcategory_id.'";</script>';
		}
	}
	if ($_POST['act'] == 'DEL_SUBCATEGORY')
	{
		if ($_POST['id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			$subcategory_id = $_POST['id'];
			$queryi=mysqli_query($conn, "delete from subcategory where subcategory_id='".$subcategory_id."'");
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully Deleted");window.location.href = "./subcategory.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./subcategory.php";</script>';
		}		
	}
	if ($_POST['act'] == 'ADD_SERVICES')
	{
		if ($_POST['service_name'] == '') { 
			echo "You must enter all fields";
		}
		else {
			 $target1 = "../assets/images/services/overview/"; 
			 $target1 = $target1 . basename( $_FILES['service_img']['name']);			
			 $service_img=($_FILES['service_img']['name']); 
			 $target2 = "../assets/images/services/detail/"; 
			 $target2 = $target2 . basename( $_FILES['service_detail_img']['name']);			
			 $service_detail_img=($_FILES['service_detail_img']['name']);
			 $target3 = "../assets/images/services/why/"; 
			 $target3 = $target3 . basename( $_FILES['why_img']['name']);			
			 $why_img=($_FILES['why_img']['name']);			 
			 $queryi="INSERT INTO services(service_id, service_name, service_desc, service_img, service_detail_img, short_desc, full_desc, why_desc, why_img, status, createdon, updatedon) VALUES (NOT NULL, '".$_POST["service_name"]."', '".$_POST["service_desc"]."', '".$service_img."', '".$service_detail_img."', '".$_POST["short_desc"]."', '".$_POST["full_desc"]."', '".$_POST["why_desc"]."', '".$why_img."', '".$_POST["status"]."', '".$date."', '".$date."')";
			 if(move_uploaded_file($_FILES['service_img']['tmp_name'], $target1)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			 if(move_uploaded_file($_FILES['service_detail_img']['tmp_name'], $target2)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			 if(move_uploaded_file($_FILES['why_img']['tmp_name'], $target3)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			//echo $queryi;
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully added.");window.location.href = "./services.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./add-services.php";</script>';
		}
	}
	if ($_POST['act'] == 'ADD_ALBUM')
	{
		if ($_POST['gallery_name'] == '') { 
			echo "You must enter all fields";
		}
		else {

			 $filename=$_FILES["image"]["name"];
			 $ext = pathinfo($filename, PATHINFO_EXTENSION);
			 $type = "preview";
			 $fname1 = $_POST["gallery_name"];
			 $uploading_time = date("d-m-Y H:i:s");
			 $image_name = $type.'_'.$fname1.'_'.$uploading_time.'.'.$ext;
			 $target = "../assets/img/portfolio/album/"; 
			 $target = $target . $image_name;			
			 $image=$image_name;

			 $filename1=$_FILES["bimage"]["name"];
			 $ext1 = pathinfo($filename, PATHINFO_EXTENSION);
			 $type1 = "preview";
			 $fname2 = $_POST["gallery_name"];
			 $uploading_time1 = date("d-m-Y H:i:s");
			 $image_name1 = $type1.'_'.$fname2.'_'.$uploading_time1.'.'.$ext1;
			 $target1 = "../assets/img/portfolio/album/banner/"; 
			 $target1 = $target1 . $image_name1;			
			 $image1=$image_name1;
			 
			 if(isset($_FILES['images'])){
				//$flag="0";				
				$name_array = $_FILES['images']['name'];
				$tmp_name_array = $_FILES['images']['tmp_name'];
				// Number of files
				$count_tmp_name_array = count($tmp_name_array);
				// We define the static final name for uploaded files (in the loop we will add an number to the end)
				for($i = 0; $i < $count_tmp_name_array; $i++){
					// Get extension of current file
					$extension = pathinfo($name_array[$i] , PATHINFO_EXTENSION);
					$type = "album";
					$fname = $_POST["gallery_name"];
					$uploading_time = date("d-m-Y H:i:s");
					$pimg = $type.'_'.$fname.'_'.$i.'_'.$uploading_time;
					$img.=$type.'_'.$fname.'_'.$i.'_'.$uploading_time.'.'.$extension."|";
					// Pay attention to $static_final_name 
					if(move_uploaded_file($tmp_name_array[$i], "../assets/img/portfolio/detail/".$pimg.".".$extension)){
						//echo $name_array[$i]." upload is complete<br>";
					} else {
						//echo "move_uploaded_file function failed for ".$name_array[$i]."<br>";
					}
				}
				$images=rtrim($img,"|");
				$slash = "|";
				$final_images=$images.$slash;			
			}
			
			$category_result = $conn->query('SELECT * FROM category WHERE category_id="'.$_POST["category"].'"');
			$category = mysqli_fetch_array($category_result);
			$category_name = $category['category_name'];		
			$combine_string = $category_name . '/' . $_POST["gallery_name"];
			$change_html_ent = array(" " => "", "&" => "-", "'" => "", "-" => "-", "_" => "_");
			$slug = strtr(strtolower($combine_string), $change_html_ent);
			 
			 $_POST["category"]=($_POST["category"]==''? 0:$_POST["category"]);
			 $_POST["event_date"]=$date;
			 $_POST["subcategory"]=($_POST["subcategory"]==''? 0:$_POST["subcategory"]);
			 $queryi="INSERT INTO gallery(gallery_id, gallery_name, preview_image, banner_image, description, event_date, location, deliverables, services, images, category, subcategory, slug, status, createdon, updatedon) VALUES (NOT NULL, '".$_POST["gallery_name"]."', '".$image."', '".$image1."', '".$_POST["description"]."', '".$_POST["event_date"]."', '".$_POST["location"]."', '".$_POST["deliverables"]."', '".$_POST["services"]."', '".$final_images."', '".$_POST["category"]."', '".$_POST["subcategory"]."', '".$slug."', '".$_POST["status"]."', '".$date."', '".$date."')";	
			 
			if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			 if(move_uploaded_file($_FILES['bimage']['tmp_name'], $target1)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			 
			//echo $queryi;
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully added.");window.location.href = "./album.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./add-album.php";</script>';
			
			
		}
	}
	if ($_POST['act'] == 'EDIT_ALBUM')
	{
		if ($_POST['gallery_id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			 $image_check1 = $_FILES['image']['name'];
			 if($image_check1==""){
				 $image = $_POST["timage"];
			 } else {
				 $filename=$_FILES["image"]["name"];
				 $ext = pathinfo($filename, PATHINFO_EXTENSION);
				 $type = "preview";
				 $fname1 = $_POST["gallery_name"];
				 $uploading_time = date("d-m-Y H:i:s");
				 $image_name = $type.'_'.$fname1.'_'.$uploading_time.'.'.$ext;
				 $target = "../assets/img/portfolio/album/"; 
				 $target = $target . $image_name;			
				 $image=$image_name; 
			 }

			 $image_check2 = $_FILES['bimage']['name'];
			 if($image_check2==""){
				 $image1 = $_POST["btimage"];
			 } else {
				 $filename1=$_FILES["bimage"]["name"];
				 $ext1 = pathinfo($filename, PATHINFO_EXTENSION);
				 $type1 = "preview";
				 $fname2 = $_POST["gallery_name"];
				 $uploading_time1 = date("d-m-Y H:i:s");
				 $image_name1 = $type1.'_'.$fname2.'_'.$uploading_time1.'.'.$ext1;
				 $target1 = "../assets/img/portfolio/album/banner/"; 
				 $target1 = $target1 . $image_name1;			
				 $image1=$image_name1; 
			 }
			$category_result = $conn->query('SELECT * FROM category WHERE category_id="'.$_POST["category"].'"');
			$category = mysqli_fetch_array($category_result);
			$category_name = $category['category_name'];		
			$combine_string = $category_name . '/' . $_POST["gallery_name"];
			$change_html_ent = array(" " => "", "&" => "-", "'" => "", "-" => "-", "_" => "_");
			$slug = strtr(strtolower($combine_string), $change_html_ent);
			
			$_POST["category"]=($_POST["category"]==''? 0:$_POST["category"]);
			$_POST["subcategory"]=($_POST["subcategory"]==''? 0:$_POST["subcategory"]);
			$queryi="UPDATE gallery SET gallery_name='".$_POST["gallery_name"]."', preview_image='".$image."', banner_image='".$image1."', category='".$_POST["category"]."', slug='".$slug."', status='".$_POST["status"]."', updatedon='".$date."' WHERE gallery_id='".$_POST["gallery_id"]."'";
			//echo $queryi;
			if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			 
			 if(move_uploaded_file($_FILES['bimage']['tmp_name'], $target1)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			 
			if ($conn->query($queryi))
			{	
				echo '<script type="text/javascript">alert("Successfully Updated");window.location.href = "./album.php";</script>';
			}
			else
				$gallery_id = $_POST["gallery_id"];
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./edit-album.php?id='.$gallery_id.'";</script>';
		}
		
	}
	if ($_POST['act'] == 'DEL_ALBUM')
	{
		if ($_POST['id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			$gallery_id = $_POST['id'];
			$queryi=mysqli_query($conn, "delete from gallery where gallery_id='".$gallery_id."'");
			
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully Deleted");window.location.href = "./album.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./album.php";</script>';
		}		
	}
	if ($_POST['act'] == 'EDIT_SERVICES')
	{
		if ($_POST['service_id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			 $target1 = "../assets/images/services/overview/"; 
			 $target1 = $target1 . basename( $_FILES['service_img']['name']);			
			 $service_img=($_FILES['service_img']['name']); 
			 $target2 = "../assets/images/services/detail/"; 
			 $target2 = $target2 . basename( $_FILES['service_detail_img']['name']);			
			 $service_detail_img=($_FILES['service_detail_img']['name']);
			 $target3 = "../assets/images/services/why/"; 
			 $target3 = $target3 . basename( $_FILES['why_img']['name']);			
			 $why_img=($_FILES['why_img']['name']);		
			$service_img=="" ? $service_img = $_POST["tservice_img"] : $service_img;
			$service_detail_img=="" ? $service_detail_img = $_POST["tservice_detail_img"] : $service_detail_img;
			$why_img=="" ? $why_img = $_POST["twhy_img"] : $why_img;
			$_POST["project_status"] == "Ongoing" ? $cdate = "" : $cdate = $_POST["completion_date"];
			$queryi="UPDATE services SET service_name='".$_POST["service_name"]."', service_desc='".$_POST["service_desc"]."', service_img='".$service_img."', service_detail_img='".$service_detail_img."', short_desc='".$_POST["short_desc"]."', full_desc='".$_POST["full_desc"]."', why_desc='".$_POST["why_desc"]."', why_img='".$why_img."', status='".$_POST["status"]."', updatedon='".$date."' WHERE service_id='".$_POST["service_id"]."'";
			//echo $queryi;
			 if(move_uploaded_file($_FILES['service_img']['tmp_name'], $target1)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			 if(move_uploaded_file($_FILES['service_detail_img']['tmp_name'], $target2)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			 if(move_uploaded_file($_FILES['why_img']['tmp_name'], $target3)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			if ($conn->query($queryi))
			{	
				echo '<script type="text/javascript">alert("Successfully Updated");window.location.href = "./services.php";</script>';
			}
			else
				$project_id = $_POST["project_id"];
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./edit-services.php?id='.$project_id.'";</script>';
		}
	}
	if ($_POST['act'] == 'DEL_SERVICE')
	{
		if ($_POST['id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			$project_id = $_POST['id'];
			$queryi=mysqli_query($conn, "delete from services where project_id='".$project_id."'");
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully Deleted");window.location.href = "./services.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./services.php";</script>';
		}		
	}
	if ($_POST['act'] == 'ADD_BLOG')
	{
		if ($_POST['blog_title'] == '') { 
			echo "You must enter all fields";
		}
		else {
			$filename=$_FILES["blog_img"]["name"];
			 $ext = pathinfo($filename, PATHINFO_EXTENSION);
			 $type = "blog";
			 //$fname1 = $_POST["gallery_name"];
			 $uploading_time = date("d-m-Y H:i:s");
			 $image_name = $type.'_'.$uploading_time.'.'.$ext;
			 $target = "../images/blog/"; 
			 $target = $target . $image_name;			
			 $image=$image_name;

			 $filename1=$_FILES["blog_detail_img"]["name"];
			 $ext1 = pathinfo($filename, PATHINFO_EXTENSION);
			 $type1 = "blog-detail";
			 //$fname2 = $_POST["gallery_name"];
			 $uploading_time1 = date("d-m-Y H:i:s");
			 $image_name1 = $type1.'_'.$uploading_time1.'.'.$ext1;
			 $target1 = "../images/blog/detail/"; 
			 $target1 = $target1 . $image_name1;			
			 $image1=$image_name1;	
			
			$blog_title = $_POST["blog_title"];
			$change_html_ent = array(" " => "-", "&" => "-", "'" => "", "-" => "-", "_" => "_", "?" => "", "!" => "");
			$slug = strtr(strtolower($blog_title), $change_html_ent);
			  
			 $queryi="INSERT INTO blog(blog_id, blog_date, blog_title, blog_img, blog_detail_img, short_desc, full_desc, category, author, slug, status, createdon, updatedon) VALUES (NOT NULL, '".$_POST["blog_date"]."', '".$_POST["blog_title"]."', '".$image."', '".$image1."', '".$_POST["short_desc"]."', '".$_POST["full_desc"]."', '".$_POST["category"]."', '".$_POST["author"]."', '".$slug."', '".$_POST["status"]."', '".$date."', '".$date."')";
			 if(move_uploaded_file($_FILES['blog_img']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			 if(move_uploaded_file($_FILES['blog_detail_img']['tmp_name'], $target1)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			//echo $queryi;
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully added.");window.location.href = "./blog.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./add-blog.php";</script>';
		}
	}
	if ($_POST['act'] == 'EDIT_BLOG')
	{
		if ($_POST['blog_id'] == '') { 
			echo "You must choose anyone";
		}
		else {			
			$image_check1 = $_FILES['blog_img']['name'];
			 if($image_check1==""){
				 $image = $_POST["tblog_img"];
			 } else {
				 $filename=$_FILES["blog_img"]["name"];
				 $ext = pathinfo($filename, PATHINFO_EXTENSION);
				 $type = "blog";
				 //$fname1 = $_POST["gallery_name"];
				 $uploading_time = date("d-m-Y H:i:s");
				 $image_name = $type.'_'.$uploading_time.'.'.$ext;
				 $target = "../images/blog/"; 
				 $target = $target . $image_name;			
				 $image=$image_name;
			 }

			 $image_check2 = $_FILES['blog_detail_img']['name'];
			 if($image_check2==""){
				 $image1 = $_POST["tblog_detail_img"];
			 } else {
				 $filename1=$_FILES["blog_detail_img"]["name"];
				 $ext1 = pathinfo($filename, PATHINFO_EXTENSION);
				 $type1 = "blog-detail";
				 //$fname2 = $_POST["gallery_name"];
				 $uploading_time1 = date("d-m-Y H:i:s");
				 $image_name1 = $type1.'_'.$uploading_time1.'.'.$ext1;
				 $target1 = "../images/blog/detail/"; 
				 $target1 = $target1 . $image_name1;			
				 $image1=$image_name1;
			 }			 
			 
			$blog_title = $_POST["blog_title"];
			$change_html_ent = array(" " => "-", "&" => "-", "'" => "", "-" => "-", "_" => "_", "?" => "", "!" => "");
			$slug = strtr(strtolower($blog_title), $change_html_ent);
			
			$queryi="UPDATE blog SET blog_date='".$_POST["blog_date"]."', blog_title='".$_POST["blog_title"]."', blog_img='".$image."', blog_detail_img='".$image1."', short_desc='".$_POST["short_desc"]."', full_desc='".$_POST["full_desc"]."', category='".$_POST["category"]."', author='".$_POST["author"]."', slug='".$slug."', status='".$_POST["status"]."', updatedon='".$date."' WHERE blog_id='".$_POST["blog_id"]."'";
			//echo $queryi;
			 if(move_uploaded_file($_FILES['blog_img']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			 if(move_uploaded_file($_FILES['blog_detail_img']['tmp_name'], $target1)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			if ($conn->query($queryi))
			{	
				echo '<script type="text/javascript">alert("Successfully Updated");window.location.href = "./blog.php";</script>';
			}
			else
				$blog_id = $_POST["blog_id"];
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./edit-blog.php?id='.$blog_id.'";</script>';
		}
	}
	if ($_POST['act'] == 'DEL_BLOG')
	{
		if ($_POST['id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			$blog_id = $_POST['id'];
			$queryi=mysqli_query($conn, "delete from blog where blog_id='".$blog_id."'");
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully Deleted");window.location.href = "./blog.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./blog.php";</script>';
		}		
	}
	if ($_POST['act'] == 'ADD_TESTIMONIALS')
	{
		if ($_POST['name'] == '') { 
			echo "You must enter all fields";
		}
		else {			
			 $filename=$_FILES["image"]["name"];
			 $ext = pathinfo($filename, PATHINFO_EXTENSION);
			 $type = "testi";
			 $fname1 = $_POST["name"];
			 $uploading_time = date("d-m-Y H:i:s");
			 $image_name = $type.'_'.$fname1.'_'.$uploading_time.'.'.$ext;
			 $target = "../assets/img/testimonial/"; 
			 $target = $target . $image_name;			
			 $image=$image_name;
			 
			 $queryi="INSERT INTO testimonials(testi_id, date, name, designation, image, content, location, ratings, status, createdon, updatedon) VALUES (NOT NULL, '".$_POST["date"]."', '".$_POST["name"]."', '".$_POST["designation"]."', '".$image."', '".$_POST["content"]."', '".$_POST["location"]."', '".$_POST["ratings"]."', '".$_POST["status"]."', '".$date."', '".$date."')";
			//echo $queryi;
			if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully added.");window.location.href = "./testimonials.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./add-testimonials.php";</script>';
		}
	}
	if ($_POST['act'] == 'EDIT_TESTIMONIALS')
	{
		if ($_POST['testi_id'] == '') { 
			echo "You must choose anyone";
		}
		else {			
			 $image_check1 = $_FILES['image']['name'];
			 if($image_check1==""){
				 $image = $_POST["timage"];
			 } else {
				 $filename=$_FILES["image"]["name"];
				 $ext = pathinfo($filename, PATHINFO_EXTENSION);
				 $type = "testi";
				 $fname1 = $_POST["name"];
				 $uploading_time = date("d-m-Y H:i:s");
				 $image_name = $type.'_'.$fname1.'_'.$uploading_time.'.'.$ext;
				 $target = "../assets/img/testimonial/"; 
				 $target = $target . $image_name;			
				 $image=$image_name; 
			 }
			 
			$queryi="UPDATE testimonials SET date='".$_POST["date"]."', name='".$_POST["name"]."', designation='".$_POST["designation"]."', image='".$image."', content='".$_POST["content"]."', location='".$_POST["location"]."', ratings='".$_POST["ratings"]."', status='".$_POST["status"]."', updatedon='".$date."' WHERE testi_id='".$_POST["testi_id"]."'";
			//echo $queryi;
			if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
			 {  
			 //Tells you if its all ok 
			 //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";  
			 } 
			 else {  
			 //Gives and error if its not 
			 //echo "Sorry, there was a problem uploading your file."; 
			 } 
			if ($conn->query($queryi))
			{	
				echo '<script type="text/javascript">alert("Successfully Updated");window.location.href = "./testimonials.php";</script>';
			}
			else
				$testi_id = $_POST["testi_id"];
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./edit-testimonials.php?id='.$testi_id.'";</script>';
		}
	}
	if ($_POST['act'] == 'DEL_TESTIMONIALS')
	{
		if ($_POST['id'] == '') { 
			echo "You must choose anyone";
		}
		else {
			$testi_id = $_POST['id'];
			$queryi=mysqli_query($conn, "delete from testimonials where testi_id='".$testi_id."'");
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Successfully Deleted");window.location.href = "./testimonials.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./testimonials.php";</script>';
		}		
	}
	if ($_POST['act'] == 'ADD_ENQUIRY')
	{
		if ($_POST['name'] == '') { 
			echo "You must enter all fields";
		}
		else {			 
			 $queryi="INSERT INTO enquiry(eid, name, mobile, email, location, subj, message, status, createdon, updatedon) VALUES (NOT NULL, '".$_POST["name"]."', '".$_POST["mobile"]."', '".$_POST["email"]."', '".$_POST["location"]."', '".$_POST["subj"]."', '".$_POST["message"]."', 0, '".$date."', '".$date."')";		 
			//echo $queryi;
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Thanks for your enquiry. We will revert back soon...!");window.location.href = "../reach-us.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "../reach-us.php";</script>';
		}
	}
	if ($_POST['act'] == 'UPDATE_ENQUIRY')
	{
		if ($_POST['id'] == '') { 
			echo "You must choose anyone";
		}
		else {			
			$queryi="UPDATE enquiry SET status=1, updatedon='".$date."' WHERE eid='".$_POST["id"]."'";
			//echo $queryi;
			if ($conn->query($queryi))
			{	
				echo '<script type="text/javascript">alert("Successfully Updated");window.location.href = "./enquiry.php";</script>';
			}
			else
				$category_id = $_POST["category_id"];
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./enquiry.php";</script>';
		}
	}
	
	if ($_POST['act'] == 'BOOK_POST')
	{
		if ($_POST['name'] == '') { 
			echo "You must enter all fields";
		}
		else {	
			  $services = $_POST["looking_for"];
			  $servicesarray = ""; 
			  //$hourcount = 0; 
			  foreach($services as $servicesarray1) 
			  { 
			  //$hourcount++;
			  $servicesarray .= $servicesarray1 . ","; 
			  } 
			 $queryi="INSERT INTO book_now(bid, date, name, mobile, email, location, events, event_date, requirement, time, shoot_type, venue, budget, insta_link, message, status, createdon, updatedon) VALUES (NOT NULL, '".$date."', '".$_POST["name"]."', '".$_POST["mobile"]."', '".$_POST["email"]."', '".$_POST["location"]."', '".$_POST["events"]."', '".$_POST["event_date"]."', '".$servicesarray."', '".$_POST["time"]."', '".$_POST["shoot_type"]."', '".$_POST["venue"]."', '".$_POST["budget"]."', '".$_POST["insta_link"]."', '".$_POST["message"]."', 0, '".$date."', '".$date."')";		 
			//echo $queryi;
			if ($conn->query($queryi))
			{					
				echo '<script type="text/javascript">alert("Thanks for your enquiry. We will revert back soon...!");window.location.href = "../reach-us.php";</script>';
			}
			else
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "../reach-us.php";</script>';
		}
	}
	
	if ($_POST['act'] == 'UPDATE_BOOK_POST')
	{
		if ($_POST['id'] == '') { 
			echo "You must choose anyone";
		}
		else {			
			$queryi="UPDATE book_now SET status=1, updatedon='".$date."' WHERE bid='".$_POST["id"]."'";
			//echo $queryi;
			if ($conn->query($queryi))
			{	
				echo '<script type="text/javascript">alert("Successfully Updated");window.location.href = "./booknow.php";</script>';
			}
			else
				$category_id = $_POST["category_id"];
				echo '<script type="text/javascript">alert("ERROR, Please try again");window.location.href = "./booknow.php";</script>';
		}
	}
}
else
{
	header('Location: ./index.php');
    exit;
}
?>

Zerion Mini 1.0