-
Notifications
You must be signed in to change notification settings - Fork 0
/
otvori_zelju.php
53 lines (46 loc) · 1.75 KB
/
otvori_zelju.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
<?php
//otvorimo zeljeni fajl i sacuvamo njegove podatke u promjenjivoj $wish koju koristimo da ispisemo rezultate na stranici
$db_folder = 'zelje_db';
if(isset($_GET['open'])) {
$file = trim($_GET['open'],"'");
} else {
header("location: ./sve_zelje.php");
}
if(file_exists($db_folder.'/'.$file)) {
$fp = fopen($db_folder.'/'.$file, 'r');
$wish_json = fread($fp, filesize($db_folder.'/'.$file));
$wish = json_decode($wish_json, true);
fclose($fp);
} else {
$e = new Exception('Letter does not exist', 222);
exit('<h1>'.$e->getCode().' - '.$e->getMessage().'</h1>');
}
?>
<?php include('header.php'); ?>
<div class="container">
<img src="Images/pismo.jpg" class="letterImg" alt="ChristmasTree">
<div class="letter-first">
My name is <?php echo $wish['firstName'].' '.$wish['lastName'] ?>.
</div>
<div class="letter-second">
I am from <?php echo $wish['city'] ?>, Montenegro.
</div>
<div class="letter-third">
This year I was a <?php echo $wish['good'] ?> kid.
</div>
<div class="letter-fourth">
This year I wish for <?php echo $wish['wish'] ?>!
</div>
<div class="letter-fifth">
<?php echo $wish['firstName'].' '.$wish['lastName'] ?>, <?php echo $wish['date'].'h' ?>
</div>
<?php if($wish['fulfilled'] == "Nope") { ?>
<div class="letter-seventh">
<i class="fa fa-times trash" aria-hidden="true"></i>
</div>
<?php } else { ?>
<div class="letter-sixth">
<i class="fas fa-check"></i>
</div>
<?php } ?>
<?php include('footer.php'); ?>