示例#1
0
<?php

require 'common.php';
if (isset($_GET['graph'])) {
    $imei = isset($_GET['imei']) ? $_GET['imei'] : decodeIMEI($_GET['code']);
    $sql = 'SELECT log_data FROM sensorlogger WHERE log_id = ' . (int) $_GET['graph'] . ' AND log_imei = \'' . m($imei) . '\'';
    $res = mysql_query($sql);
    if (mysql_num_rows($res) == 0) {
        die('Data not found');
    }
    $row = mysql_fetch_assoc($res);
    $datax = array();
    $datay = array();
    $dataz = array();
    foreach (explode("\n", $row['log_data']) as $line) {
        if (preg_match('/([0-9]+):(?:.*?,.*?,.*?,){' . ($_GET['ds'] - 1) . '}([0-9\\.\\-]+),([0-9\\.\\-]+),([0-9\\.\\-]+)/', $line, $m)) {
            $datax[] = (double) $m[2];
            $datay[] = (double) $m[3];
            $dataz[] = (double) $m[4];
        }
    }
    $im = imagecreatetruecolor(count($datax) * 2, 330);
    $w = imagecolorallocate($im, 255, 255, 255);
    imagefill($im, 0, 0, $w);
    $r = imagecolorallocate($im, 255, 0, 0);
    $g = imagecolorallocate($im, 0, 255, 0);
    $b = imagecolorallocate($im, 0, 0, 255);
    $grey = imagecolorallocate($im, 200, 200, 200);
    $lgrey = imagecolorallocate($im, 230, 230, 230);
    $minx = min($datax);
    $maxx = max($datax);
示例#2
0
<?php

require_once 'common.php';
if (isset($_GET['code'])) {
    define('CODE', htmlentities($_GET['code']));
    define('IMEI', $_GET['imei'] = decodeIMEI($_GET['code']));
} else {
    die('Invalid code specified');
}
$sql = 'SELECT log_activity, log_id, log_statuscode FROM sensorlogger WHERE log_imei = \'' . m(IMEI) . '\'';
$res = mysql_query($sql);
echo '<?xml version="1.0"?>';
?>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>SensorLogger Results</title>
    <link rel="stylesheet" type="text/css" href="/style.css"/>
    <style type="text/css">
     .qr { float: left; clear: left; margin-right: 15px; }
     .qr img { width: 128px; }
    </style>
  </head>
  <body style="margin-top: 0; padding-top: 0;">
    <h1 style="background: url('/android/android.png') no-repeat right; padding-top: 50px; margin-top: 0;">SensorLogger results for <span><?php 
echo IMEI;
?>
</span></h1>
    <div>
<?php 
if (($num = mysql_num_rows($res)) == 0) {
    ?>