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

$title=$_POST['title'];
$type=$_POST['type'];
$uname=$_POST['uname'];
$mobb=$_POST['mobb'];
$email=$_POST['email'];
$des=$_POST['des'];

$sql2="SELECT * FROM `savePack` WHERE `title`='".$title."' && `type`='".$type."' && `mobb`='".$mobb."'";
$rs2=mysqli_query($conn,$sql2);
$chk2=mysqli_num_rows($rs2);
if($chk2>0)
{
		echo '<script>alert("Properties already exist. Try with new properties");</script>';
	 	echo '<script>window.location.href="packs.php";</script>';
}
else
{
	$temp = explode(".",$_FILES["image"]["name"]);
	$target_dir='images/'.date('Ymdhis').'.'.end($temp);

	
		$FileType = strtolower(pathinfo($target_dir,PATHINFO_EXTENSION));
		if($FileType != "png" && $FileType != "jpg" && $FileType != "jpeg" && $FileType != "gif")
		{
		// file format not supportedonly images allows
		 echo '<script>alert("Invalid image format");</script>';
	 	echo '<script>window.location.href="packs.php";</script>';
		
		}
		else
		{
			move_uploaded_file($_FILES["image"]["tmp_name"],$target_dir);
			$sql="INSERT INTO `savePack`(`title`, `type`, `uname`, `mobb`,`email`, `descc`, `pack_img`, `datee`, `timee`) VALUES ('".$title."','".$type."','".$uname."','".$mobb."','".$email."','".$des."','".$target_dir."','".date('Y-m-d')."','".date('h:i:s A')."')";
			$rs=mysqli_query($conn,$sql);
			if($rs>0)
			{
				echo '<script>window.location.href="packs.php";</script>';
			}
			else
			{
				echo '<script>alert("Unable to save properties");</script>';
	 			echo '<script>window.location.href="packs.php";</script>';
			}
		}
	
}

	

?>