-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathheartbeat.php
More file actions
33 lines (25 loc) · 892 Bytes
/
heartbeat.php
File metadata and controls
33 lines (25 loc) · 892 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
<?php
#print_r($_GET);
$serial = $_GET['serial'];
$version = $_GET['version'];
$fw = $_GET['fw'];
$int_ip = $_GET['intip'];
$tag = $_GET['tag'];
$event = $_GET['event'];
$ext_ip = $_SERVER['REMOTE_ADDR'];
$link = mysql_connect('localhost', 'REPLACE_USERNAME', 'REPLACE_PASSWORD');
if (!$link) {
die('Not connected : ' . mysql_error());
}
$db_selected = mysql_select_db('brightsign', $link);
if (!$db_selected) {
die ('Can\'t use foo : ' . mysql_error());
}
$sql1 = "DELETE FROM heartbeats WHERE snum='$serial';";
$result1 = mysql_query($sql1) or die(mysql_error());
if ($tag=="") $tag="none";
if ($event=="") $event="none";
$sql2 = "INSERT INTO heartbeats (snum,version,fw,int_ip,ext_ip,tag,event) VALUES ('$serial','$version','$fw','$int_ip','$ext_ip','$tag','$event');";
$result2 = mysql_query($sql2) or die(mysql_error());
exit(header("Status: 200 OK"));
?>