<?php
session_start();

	if(!isset($_SESSION['tulsilogin']))
	{
		header('Location: index.php');
		return;
	}
		




	include("connect.php");
	include("mylibrary.php");

	$settingmid=$_POST['settingmid'];
	$footertext=checkvalidstring($_POST['footertext']);
	$pdfheaderline1=checkvalidstring($_POST['pdfheaderline1']);
	$emailsubject=checkvalidstring($_POST['emailsubject']);
	

$headerimg='';
$attach22='';
	if(empty($_FILES['headerimg']['name']) == false  )
	{
		$image2=$_FILES['headerimg']['name'];
		$ext1 = pathinfo($image2, PATHINFO_EXTENSION);
		$headerimg = date("YmdHis").$_FILES['headerimg']['name'];
		$path = "images";
		if($ext1=='png' || $ext1=='jpg' || $ext1=='jpeg')
		 {
		move_uploaded_file( $_FILES['headerimg']['tmp_name'], $path ."/". $headerimg );

		$attach22 = ",headerimg='$headerimg'";
		}
	}
$footerimg='';
$attach23='';
	  if(empty($_FILES['footerimg']['name']) == false  )
	{
		$image3=$_FILES['footerimg']['name'];
		$ext1 = pathinfo($image3, PATHINFO_EXTENSION);
		$footerimg = date("YmdHis").$_FILES['footerimg']['name'];
		$path = "images";
		if($ext1=='png' || $ext1=='jpg' || $ext1=='jpeg')
		 {
		move_uploaded_file( $_FILES['footerimg']['tmp_name'], $path ."/". $footerimg );

		$attach23 = ",footerimg='$footerimg'";
		}
	}
	
	
	
	
	   $eve = "update res_setting_master set footertext='$footertext',pdfheaderline1='$pdfheaderline1',emailsubject='$emailsubject' $attach23 $attach22 where settingmid=$settingmid";
	
	

	if ($conn->query($eve) === TRUE)
	{
		$_SESSION['msg'] = "General Settings Information Updated";


	}
	header("Location: settingedit.php");
?>
