-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
75 lines (60 loc) · 1.93 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
function error($msg) {
return '<span style="font-size:10px;font-weight:normal;">' . $msg . '</span>';
}
$city = isset($_GET['loc'])? $_GET['loc'] : '';
$deg = isset($_GET['deg'])? $_GET['deg'] : 'c';
if(empty($city) || stristr($deg, 'DEGREE') || stristr($city, 'location')) {
$out = error('read the readme!');
} else {
require './get_weather.php';
$api = new GetWeather($city, $deg);
$res = $api->get_degree();
if(empty($res)) {
$out = error('ur doin somthn wrng');
} else {
file_put_contents($api->cache, $res);
$out = $res . '°';
}
}
// Extra Options:
$refresh = (isset($_GET['refresh']) && $_GET['refresh'] >= (60*30))? $_GET['refresh'] : 60*30;
$ext_stylesheet = isset($_GET['style'])? $_GET['style'] : '';
$font = isset($_GET['font'])? $_GET['font'] : 'Helvetica Neue';
$font_color = isset($_GET['color'])? $_GET['color'] : 'fff';
$font_size = isset($_GET['size'])? $_GET['size'] : '20';
$opacity = isset($_GET['opacity'])? $_GET['opacity'] : '1';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>iPhone Weather</title>
<meta http-equiv="refresh" content="<?php echo $refresh ?>" />
<style type="text/css" media="screen">
* {
margin: 0;
padding: 0;
}
body {
width: 320px;
background: transparent;
color: #<?php echo $font_color ?>;
font: <?php echo $font_size ?>px <?php echo $font ?>;
}
#weather {
font-weight: bold;
position: absolute;
right: 10px;
opacity: <?php echo $opacity ?>;
}
</style>
<link rel="stylesheet" href="<?php echo $ext_stylesheet ?>" type="text/css" media="screen" title="custom style" charset="utf-8" />
</head>
<body>
<div id="weather">
<p><?php echo $out ?></p>
</div>
</body>
</html>