Mercurial > hg > index.fcgi > www > www-1
comparison weather/index.php @ 28:28221b9bb370
add weather/; update myrss/FEEDS; add umask(0037) to weather/index.php and myrss/index.php
author | paulo@thepaulopc |
---|---|
date | Thu, 23 Jun 2011 00:41:19 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:69ae6a55373c |
---|---|
1 <HTML> | |
2 <HEAD> | |
3 <TITLE>Weather</TITLE> | |
4 <LINK REL="stylesheet" TYPE="text/css" HREF="index.css"> | |
5 </HEAD> | |
6 | |
7 <BODY> | |
8 | |
9 <?php | |
10 umask(0037); | |
11 | |
12 $start_time = microtime(true); | |
13 | |
14 $cache_fn = "__cache__.txt"; | |
15 $cache_life = "86400"; | |
16 | |
17 $cache_mtime = "0"; | |
18 if (file_exists($cache_fn) && filesize($cache_fn) > 0) | |
19 $cache_mtime = filemtime($cache_fn); | |
20 | |
21 $newbody = ''; | |
22 | |
23 if ((time() - $cache_mtime >= $cache_life)) { | |
24 $newbody = shell_exec('./getweather.sh'); | |
25 file_put_contents($cache_fn, $newbody); | |
26 } else { | |
27 $newbody = file_get_contents($cache_fn); | |
28 } | |
29 | |
30 $end_time = microtime(true); | |
31 $elapsed_time = $end_time - $start_time; | |
32 | |
33 echo "<PRE>"; | |
34 echo $newbody; | |
35 echo "</PRE>"; | |
36 | |
37 echo "<DIV class=\"debug\">Time elapsed: " . sprintf("%.3f", $elapsed_time) . " seconds.</DIV>"; | |
38 ?> | |
39 | |
40 </BODY> | |
41 </HTML> |