view 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
line source
1 <HTML>
2 <HEAD>
3 <TITLE>Weather</TITLE>
4 <LINK REL="stylesheet" TYPE="text/css" HREF="index.css">
5 </HEAD>
7 <BODY>
9 <?php
10 umask(0037);
12 $start_time = microtime(true);
14 $cache_fn = "__cache__.txt";
15 $cache_life = "86400";
17 $cache_mtime = "0";
18 if (file_exists($cache_fn) && filesize($cache_fn) > 0)
19 $cache_mtime = filemtime($cache_fn);
21 $newbody = '';
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 }
30 $end_time = microtime(true);
31 $elapsed_time = $end_time - $start_time;
33 echo "<PRE>";
34 echo $newbody;
35 echo "</PRE>";
37 echo "<DIV class=\"debug\">Time elapsed: " . sprintf("%.3f", $elapsed_time) . " seconds.</DIV>";
38 ?>
40 </BODY>
41 </HTML>