-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlamp.php
More file actions
43 lines (36 loc) · 764 Bytes
/
lamp.php
File metadata and controls
43 lines (36 loc) · 764 Bytes
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
<!DOCTYPE html>
<!-- This is a sample of how to get garagemhacker status using php
* Get the status.txt state on $status exploded array
* Show div from the status value
-->
<html>
<head>
<title>Changing image from php</title>
<style>
.lampon{
width: 100px;
height: 100px;
background: #ff0; //Yellow brick
}
.lampoff{
width: 100px;
height: 100px;
background: #000; //Black brick
}
</style>
</head>
<body>
<?php
$file = 'http://garagemhacker.org/status.txt';
$status = explode("\n", file_get_contents($file));
if ($status[0] == 'aberto'){
//Mostrar imagem com lampada acesa
echo '<div class="lampon"></div>';
}
else {
//Mostrar imagem com lampada apagada
echo '<div class="lampoff"></div>';
}
?>
</body>
</html>