GIF89a php
Current File : /home/hencockfreshchic/public_html/admin.cpanel/updateEvent.php
<?php
ob_start();
ini_set('error_reporting', E_STRICT);
include("connect.php");
mysqli_set_charset($conn,'utf8');
date_default_timezone_set('Asia/Kolkata');

$ename=$_POST['ename'];
$sdate=$_POST['sdate'];
$edate=$_POST['edate'];
$esr=$_POST['esr'];

$target_dir='events_img/'.mt_rand(100,987).mt_rand(985,1453).trim($_FILES["pic"]["name"]);

$FileType = strtolower(pathinfo($target_dir,PATHINFO_EXTENSION));
	if($FileType != "png" && $FileType != "jpg" && $FileType != "jpeg" )
{
	 echo '<script>alert("Invalid event image format");</script>';
 	echo '<script>window.location.href="events.php";</script>';	
}
else
{	
		move_uploaded_file($_FILES["pic"]["tmp_name"],$target_dir);
		// save event
		$sql2="UPDATE `events` SET `event_name`='".$ename."',`event_image`='".$target_dir."',`event_sdate`='".$sdate."',`event_edate`='".$edate."' WHERE `sr`='".$esr."'";
		$rs2=mysqli_query($conn,$sql2);
		if($rs2>0)
		{
				echo '<script>alert("Yahoo !! Event schduled updated on the given date successfully");</script>';
 				echo '<script>window.location.href="events.php";</script>';
		}
		else
		{
			echo '<script>alert("Error : Unable to update event | Contact to developers");</script>';
 			echo '<script>window.location.href="events.php";</script>';	
		}	
}

?>