-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcity.php
124 lines (122 loc) · 5.01 KB
/
city.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
<?php
header('Content-type: text/html; charset=iso-8859-1');
$qr = "";
$d = "";
if(isset($_GET["d"]) && $_GET["d"] != "") $d = "d=$_GET[d]&";
$qr = "http://127.0.0.1/webmuseoscuola/city.php?$d";
if(isset($_GET["lang"])){
$strings = array();
switch($_GET["lang"]){
case "en":{
$strings[] = "en";
$strings[] = "Awesome! Now choose a museum or artist from that city.";
$strings[] = "name";
$strings[] = "We couldn't find anything on our database...";
$strings[] = "We'll try our best to fix this!";
$strings[] = "Ops... Looks like we got an error!";
break;
}
case "it":{
$strings[] = "it";
$strings[] = "Fantastico! Ora scegli un museo o artista da quella città.";
$strings[] = "nome";
$strings[] = "Non abbiamo trovato nulla nel nostro database...";
$strings[] = "Faremo del nostro meglio per risolvere ciò!";
$strings[] = "Ops... Si è verificato un errore!";
break;
}
default:{
header("Location: $qr"."lang=en");
exit();
}
}
}
else {
header("Location: $qr"."lang=en");
exit();
}
?>
<!DOCTYPE html>
<html lang=en>
<head>
<link rel="icon" href="./favicon.ico" />
<meta charset=iso-8859-1>
<link rel="stylesheet" href="./res/style/style.css" type="text/css" />
<link rel="stylesheet" href="./res/style/content.css" type="text/css" />
<title>Web Musei</title>
</head>
<body>
<a href="./index.htm"><img style="float: left;" src="./res/img/back.png" /></a><img style="float: left;" src="./res/img/lang.png" /><a href="./home.php?lang=it">Italiano</a> <a href="./home.php?lang=en">English</a>
<div class=headerCountainer>
<a href="./home.php?lang=<?php echo $strings[0]; ?>"><img class=icon src="./res/icon.png" alt="Web Musei" title="Home"></a>
</div>
<div class=bodyCountainer>
<p class=title><?php echo $strings[1]; ?></p>
<div class=listHolder>
<div class=list>
<div class="listTitle">Museums</div>
<?php
$connection = mysqli_connect("127.0.0.1","guest","","musei");
if($connection != FALSE && isset($_GET["d"])){
$sql = "SELECT musei.$strings[2], musei.immagine FROM musei, citta WHERE citta.codCitta = musei.codCitta AND citta.$strings[2] = \"".str_replace("_"," ",$_GET["d"])."\" ORDER BY musei.$strings[2]";
$result = mysqli_query($connection,$sql);
if($result != FALSE){
if(mysqli_num_rows($result) > 0){
while($data = mysqli_fetch_assoc($result)){
$string = str_replace(" ","_",$data[$strings[2]]);
if($data["immagine"] == NULL)
$img = "./res/img/missing.png";
else
$img = $data["immagine"];
echo "<a href=./museum.php?d=$string&lang=$strings[0]><div class=content><img src=$img class=thumb />".$data[$strings[2]]."</div></a>";
}
}
else {
echo "<div style='text-align: center'><img src='./res/img/nothing.png' class=thumb /><p style='align: center'>$strings[3]</p>$strings[4]</div>";
}
}
else {
if($result == FALSE) echo "<div style='text-align: center'><img src='./res/img/error.png' class=thumb /><p style='align: center'>$strings[5]</p>Query error</div>";
}
}
else {
echo "<div style='text-align: center'><img src='./res/img/error.png' class=thumb /><p style='align: center'>$strings[5]</p>".mysqli_connect_error()."</div>";
}
?>
</div>
</div>
<div class=listHolder style="float: right;">
<div class=list>
<div class="listTitle">Artists</div>
<?php
if($connection != FALSE && isset($_GET["d"])){
$sql = "SELECT artisti.nome, artisti.immagine FROM artisti, citta WHERE citta.codCitta = artisti.codCitta AND citta.$strings[2] = \"".str_replace("_"," ",$_GET["d"])."\" ORDER BY artisti.nome";
$result = mysqli_query($connection,$sql);
if($result != FALSE){
if(mysqli_num_rows($result) > 0){
while($data = mysqli_fetch_assoc($result)){
$string = str_replace(" ","_",$data["nome"]);
if($data["immagine"] == NULL)
$img = "./res/img/missing.png";
else
$img = $data["immagine"];
echo "<a href=./artist.php?d=$string&lang=$strings[0]><div class=content><img src=$img class=thumb />$data[nome]</div></a>";
}
}
else {
echo "<div style='text-align: center'><img src='./res/img/nothing.png' class=thumb /><p style='align: center'>$strings[3]</p>$strings[4]</div>";
}
}
else {
if($result == FALSE) echo "<div style='text-align: center'><img src='./res/img/error.png' class=thumb /><p style='align: center'>$strings[5]</p>Query error</div>";
}
}
else {
echo "<div style='text-align: center'><img src='./res/img/error.png' class=thumb /><p style='align: center'>$strings[5]</p>".mysqli_connect_error()."</div>";
}
?>
</div>
</div>
</div>
</body>
</html>