-
Notifications
You must be signed in to change notification settings - Fork 10
/
eq.php
69 lines (61 loc) · 3.73 KB
/
eq.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
<?php include('livedata.php');header('Content-type: text/html; charset=utf-8');
//current eq
date_default_timezone_set($TZ);
//$json_string=file_get_contents('http://earthquake-report.com/feeds/recent-eq?json');
$json_string=file_get_contents('jsondata/eqnotification.txt');
$parsed_json=json_decode($json_string,true);
$magnitude1=$parsed_json{0}{'magnitude'};
$magnitude=number_format($magnitude1,1);
$title=$parsed_json{0}['title'];
$eqtitle=$parsed_json{0}['location'];
$depth=$parsed_json{0}['depth'];
$time1=$parsed_json{0}['date_time'];
$lati=$parsed_json{0}['latitude'];
$longi=$parsed_json{0}['longitude'];
$eventime=date( $dateFormat . " " . $timeFormatShort, strtotime("$time1") );
$shorttime=date( $timeFormatShort, strtotime("$time1") );
?>
<?php
// CALCULATE THE DISTANCE OF LATEST EARTHQUAKE //
// de LOCATION OF HOMEWEATHER STATION //
// Brian Underdown July 28th 2016 //
$eqdist;if ($weather["wind_units"] == 'mph') {$eqdist = round(distance($lat, $lon, $lati, $longi) * 0.621371) ."mi";} else {$eqdist = round(distance($lat, $lon, $lati, $longi)) ."km";}
$eqdista;if ($weather["wind_units"] == 'mph') {$eqdista = round(distance($lat, $lon, $lati, $longi) * 0.621371) ."<smallrainunit>mi";} else {$eqdista = round(distance($lat, $lon, $lati, $longi)) ."<smallrainunit>km";} ?>
<div class="updatedtime">
<span><?php
$updated=filemtime('jsondata/eqnotification.txt');
echo $online, " ",date($timeFormat, $updated);?></span>
</div>
<br />
<div class="tempindoorconverter">
<?php //chuck
if($eqdista <= 200){echo "<div class=tempconvertercirclered>".$eqdista ;}
else if($eqdista <= 500){echo "<div class=tempconvertercircleorange>".$eqdista ;}
else if($magnitude <=1000){echo "<div class=tempconvertercircleyellow>".$eqdista;}
else if($magnitude >= 1000){echo "<div class=tempconvertercirclegreen>".$eqdista ;}
?></smalltempunit2></div></div>
<div class='eqcontainer1'>
<!-- EQ homeweather station earthquakes now with value values 27th July 2016-->
<?php
// EQ Latest earthquake
if ($magnitude <= 0) {
echo "<div class='eqcaution'>Magnitude</div><div class=eqtoday1-3>${magnitude}</div>
<div class=\"eqtext\"><value> $eqtitle <br><value>$eventime</value><br> Epicenter: <value><grey>$eqdist <valueearthquake>from<br> $stationlocation</valueearthquake></value></div>";
} else if ($magnitude <= 4.2) {
echo "<div class='eqcaution'>Magnitude</div><div class=eqtoday4-5>${magnitude}</div>
<div class='eqt'> Minor</div></div><div class=\"eqtext\"><value> $eqtitle <br><value>$eventime<br>
Epicenter: <value><maxred>$eqdist</maxred> <valueearthquake>from<br> $stationlocation</valueearthquake></value></div>";
} else if ($magnitude <= 5) {
echo "<div class='eqcaution'>Magnitude</div><div class=eqtoday4-5>${magnitude}</div>
<div class='eqt'> Moderate</div></div><div class=\"eqtext\"><value> $eqtitle <br><value>$eventime<br>
Epicenter: <value><maxred>$eqdist</maxred> <valueearthquake>from<br> $stationlocation</valueearthquake></value></div>";
} else if ($magnitude<= 6) {
echo "<div class='eqcaution'>Magnitude</div><div class=eqtoday6-8>${magnitude}</div>
<div class='eqt'> Strong</div></div><div class=\"eqtext\"><value> $eqtitle <br><value>$eventime<br>
<value><maxred>$eqdist</maxred> <valueearthquake>from<br> $stationlocation</valueearthquake></value></div>";
} else if ($magnitude <= 10) {
echo "<div class='eqcaution'>Magnitude</div><div class=eqtoday9-10>${magnitude}</div>
<div class='eqt'> Very Strong</div></div><div class=\"eqtext\"><value> $eqtitle <br><value>$eventime<br><depth>depth:$depth km</depth><br>
Epicenter: <value><maxred>$eqdist</maxred></maxred> <valueearthquake>from<br> $stationlocation</valueearthquake></value></div>";
}
?></div>