-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
57 lines (45 loc) · 1.39 KB
/
index.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
<!doctype html>
<html>
<head>
<title>Twente Milieu iCal</title>
<style>
form, div {
margin: 20px auto;
width: 250px;
font: 14px Tahoma;
}
form input {
float: right;
}
</style>
</head>
<body>
<?php
if ( $_GET['postcode'] && $_GET['huisnummer'] ) {
require 'classes/twente_milieu.php';
try {
$afvalkalender = new TwenteMilieu($_GET['postcode'], $_GET['huisnummer']);
$url = 'http://'.$_SERVER["SERVER_NAME"].dirname($_SERVER["REQUEST_URI"]);
$url .= '/ical.php';
$url .='?postcode='.$afvalkalender->safePostcode().'&huisnummer='.$afvalkalender->safeHuisnummer();
?>
<div>
<p>Voeg deze url toe aan je agenda:</p>
<a href="<?php echo $url; ?>"><?php echo $url; ?></a>
</div>
<?php } catch ( Exception $e ) { ?>
<div>
<p>Sorry, je input is niet geldig :/</p>
<p><?php echo $e->getMessage(); ?></p>
<a href="index.php">Terug</a>
</div>
<?php } ?>
<?php } else { ?>
<form method="get" action="">
<p>Postcode: <input type="text" name="postcode" value="" placeholder="1234AB"/></p>
<p>Huisnummer: <input type="text" name="huisnummer" value="" placeholder="123"/></p>
<input type="submit" value="Maak iCal link!"/>
</form>
<?php } ?>
</body>
</html>