<?php
session_start();
require("config.php");
if(!isset($_SESSION['auser'])){
header("location:index.php");
}
$error="";
$msg="";
if(isset($_POST['add'])){
$title=$_POST['title'];
$content=$_POST['content'];
$ptype=$_POST['ptype'];
$bhk=$_POST['bhk'];
$bed=$_POST['bed'];
$balc=$_POST['balc'];
$hall=$_POST['hall'];
$stype=$_POST['stype'];
$bath=$_POST['bath'];
$kitc=$_POST['kitc'];
$floor=$_POST['floor'];
$price=$_POST['price'];
$city=$_POST['city'];
$asize=$_POST['asize'];
$loc=$_POST['loc'];
$state=$_POST['state'];
$status=$_POST['status'];
$uid=$_POST['uid'];
$feature=$_POST['feature'];
$totalfloor=$_POST['totalfl'];
$aimage=$_FILES['aimage']['name'];
$aimage1=$_FILES['aimage1']['name'];
$aimage2=$_FILES['aimage2']['name'];
$aimage3=$_FILES['aimage3']['name'];
$aimage4=$_FILES['aimage4']['name'];
$fimage=$_FILES['fimage']['name'];
$fimage1=$_FILES['fimage1']['name'];
$fimage2=$_FILES['fimage2']['name'];
$isFeatured=$_POST['isFeatured'];
$temp_name=$_FILES['aimage']['tmp_name'];
$temp_name1=$_FILES['aimage1']['tmp_name'];
$temp_name2=$_FILES['aimage2']['tmp_name'];
$temp_name3=$_FILES['aimage3']['tmp_name'];
$temp_name4=$_FILES['aimage4']['tmp_name'];
$temp_name5=$_FILES['fimage']['tmp_name'];
$temp_name6=$_FILES['fimage1']['tmp_name'];
$temp_name7=$_FILES['fimage2']['tmp_name'];
move_uploaded_file($temp_name,"property/$aimage");
move_uploaded_file($temp_name1,"property/$aimage1");
move_uploaded_file($temp_name2,"property/$aimage2");
move_uploaded_file($temp_name3,"property/$aimage3");
move_uploaded_file($temp_name4,"property/$aimage4");
move_uploaded_file($temp_name5,"property/$fimage");
move_uploaded_file($temp_name6,"property/$fimage1");
move_uploaded_file($temp_name7,"property/$fimage2");
$sql="INSERT INTO property (title,pcontent,type,bhk,stype,bedroom,bathroom,balcony,kitchen,hall,floor,size,price,location,city,state,feature,pimage,pimage1,pimage2,pimage3,pimage4,uid,status,mapimage,topmapimage,groundmapimage,totalfloor,isFeatured) VALUES('$title','$content','$ptype','$bhk','$stype','$bed','$bath','$balc','$kitc','$hall','$floor','$asize','$price','$loc','$city','$state','$feature','$aimage','$aimage1','$aimage2','$aimage3','$aimage4','$uid','$status','$fimage','$fimage1','$fimage2','$totalfloor','$isFeatured')";
$result=mysqli_query($con,$sql);
if($result){
$msg="<p class='alert alert-success'>Apartments Inserted Successfully</p>";
}else{
$error="<p class='alert alert-warning'>Something went wrong. Please try again</p>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=0">
<title>Clan Homes</title>
<link rel="shortcut icon" type="image/x-icon" href="assets/img/favicon.png">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/css/feathericon.min.css">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<?php include("header.php");?>
<div class="page-wrapper">
<div class="content container-fluid">
<div class="page-header">
<div class="row">
<div class="col">
<h3 class="page-title">Apartments</h3>
<ul class="breadcrumb">
<li class="breadcrumb-item"><a href="dashboard.php">Dashboard</a></li>
<li class="breadcrumb-item active">Apartments</li>
</ul>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h4 class="card-title">Add Apartments Details</h4>
</div>
<form method="post" enctype="multipart/form-data">
<div class="card-body">
<h5 class="card-title">Apartments Detail</h5>
<?php echo $error;?>
<?php echo $msg;?>
<input type="submit" value="Submit" class="btn btn-primary" name="add" style="margin-left:200px;">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="assets/js/jquery-3.2.1.min.js"></script>
<script src="assets/plugins/tinymce/tinymce.min.js"></script>
<script src="assets/plugins/tinymce/init-tinymce.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="assets/js/script.js"></script>
</body>
</html>
