-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathview.php
48 lines (40 loc) · 1.04 KB
/
view.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
<?php
if(!empty($_GET['id'])){
//DB details
$dbHost = 'localhost';
$dbUsername = 'root';
$dbPassword = '';
$dbName = 'users';
//Create connection and select DB
$db = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);
//Check connection
if($db->connect_error){
die("Connection failed: " . $db->connect_error);
}
//Get image data from database
$result = $db->query("SELECT * FROM houses WHERE id = {$_GET['id']}");
if($result->num_rows > 0){
$imgData = $result->fetch_assoc();
//Render image
header("Content-type: image/jpg");
if($_GET['no']==1)
{
echo $imgData['image'];
}
elseif($_GET['no']==2)
{
echo $imgData['image2'];
}
elseif($_GET['no']==3)
{
echo $imgData['image3'];
}
elseif($_GET['no']==4)
{
echo $imgData['image4'];
}
}else{
echo 'Image not found...';
}
}
?>