-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpropertyold.php
200 lines (191 loc) · 5.81 KB
/
propertyold.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
session_start();
$id=$_SESSION['property_id'];
$conn = mysqli_connect("localhost", "root", "", "easyhomes", 3306);
$select=mysqli_query($conn,"SELECT * FROM property WHERE property_id=$id");
$search_user=mysqli_query($conn,"SELECT user_id FROM user_owns WHERE property_id=$id");
$row=mysqli_fetch_assoc($select);
$user_id=mysqli_fetch_assoc($search_user);
$uid=$user_id['user_id'];
$get_user=mysqli_query($conn,"SELECT * FROM users WHERE user_id=$uid");
$user=mysqli_fetch_assoc($get_user);
$location=$row['location'];
$coordinates=explode(",",$location);
if($row['category']=="both")
{
$for="Sale and Rent";
$get_price=mysqli_query($conn,"SELECT price FROM sale_price WHERE property_id=$id");
$get_rprice=mysqli_query($conn,"SELECT rprice FROM rent_price WHERE property_id=$id");
$price=mysqli_fetch_assoc($get_price);
$rprice=mysqli_fetch_assoc($get_rprice);
}
else if($row['category']=="sale")
{
$for="Sale";
$get_price=mysqli_query($conn,"SELECT price FROM sale_price WHERE property_id=$id");
$price=mysqli_fetch_assoc($get_price);
}
else
{
$for="Rent";
$get_price=mysqli_query($conn,"SELECT rprice FROM rent_price WHERE property_id=$id");
$price=mysqli_fetch_assoc($get_price);
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Property <?php echo $id ?></title>
<style type="text/css">
/* Set the size of the div element that contains the map */
#map {
height: 400px;
/* The height is 400 pixels */
width: 400px;
/* The width is the width of the web page */
}
img{
max-height: 100%;
max-width: 100%;
}
</style>
<script>
// Initialize and add the map
function initMap() {
// The location of Uluru
const location = { lat: <?php echo $coordinates[0] ?>, lng: <?php echo $coordinates[1] ?> };
// The map, centered at Uluru
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 20,
center: location,
});
// The marker, positioned at Uluru
const marker = new google.maps.Marker({
position: location,
map: map,
});
}
</script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<h1><?php echo $id ?></h1>
<div style="width:600px; height: 600px;">
<img src="<?php echo $row['images'] ?>">
</div>
<div>
Category: <?php echo $for ?>
</div>
<div>
Description: <?php echo $row['description'] ?>
</div>
<div>
Area: <?php echo $row['area'] ?> sq.ft
</div>
<?php
if($row['age']!=NULL)
{
?>
<div>
Property Age: <?php echo $row['age'] ?> Years
</div>
<?php
}
if($for=="Sale and Rent")
{
?>
<div>
Price for Sale: <?php echo $price['price'] ?>
</div>
<div>
Price for Rent: <?php echo $rprice['rprice'] ?> / Month
</div>
<?php
}
else if($for=="Sale")
{
?>
<div>
Price for Sale: <?php echo $price['price'] ?>
</div>
<?php
}
else
{
?>
<div>
Price for Rent: <?php echo $price['rprice'] ?> / Month
</div>
<?php
}
?>
<h3>Location:</h3>
<!--The div element for the map -->
<div id="map"></div>
<h4>Owner Details:</h4>
<div>
Name: <?php echo $user['name'] ?>
</div>
<div>
Gender: <?php
if($user['gender']==1)
{
echo "Male";
}
else if($user['gender']==2)
{
echo "Female";
}
else
{
echo "NA";
}
?>
</div>
<div>
Phone Number: <?php echo $user['phone_number'] ?>
</div>
<div>
Email ID: <?php echo $user['email'] ?>
</div>
<br><br>
<div col="row">
<form action="#" method="POST">
<button class="btn btn-primary" name="visit" value="visit" type="submit">Book a Visit</button>
<?php
if($for=="Rent" || $for=="Sale and Rent")
{
?>
<button class="btn btn-primary" name="rent" value="rent" type="submit">Take on Rent</button>
<?php
}
?>
<br>
Interested? Submit Your details and the Owner will Contact you back<br>
<button class="btn btn-primary" name="details" value="details" type="submit">Submit Your Details</button>
</form>
</div>
<!-- Async script executes immediately and must be after any DOM elements used in callback. -->
<script
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBimqJizKom7LcizcvUdr-BGGq8dHEtCbE&callback=initMap&libraries=&v=weekly"
async
></script>
</body>
</html>
<?php
if(!empty($_POST['visit']))
{
header('location:visit.php');
}
if(!empty($_POST['rent']))
{
header('location:rent.php');
}
if(!empty($_POST['details']))
{
header('location:details.php');
}
?>