-
Notifications
You must be signed in to change notification settings - Fork 0
/
ss_temperature.php
40 lines (28 loc) · 999 Bytes
/
ss_temperature.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
<?php
require_once("/home/cacti/www_secure/db.php");
/* do NOT run this script through a web browser */
if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
die("<br><strong>This script is only meant to run at the command line.</strong>");
}
$no_http_headers = true;
/* display ALL errors */
error_reporting(0);
if (!isset($called_by_script_server)) {
include_once(dirname(__FILE__) . "/../include/global.php");
print call_user_func("ss_temperature");
}
function ss_temperature() {
// $db_host = "localhost";
// $db_user = "gk";
// $db_pass = "gk";
// $db_db = "instrumentation";
// $idb = new mysqli($db_host, $db_user, $db_pass, $db_db);
$idb = db_link();
$query = "SELECT name, temperature FROM temperature WHERE name IS NOT NULL ";
$result = $idb->query($query);
$output = "";
while ($row = $result->fetch_object())
$output .= $row->name.':'.$row->temperature.' ';
return $output;
}
?>