Last change
on this file since 74 was 74, checked in by chronos, 8 years ago |
- Modified: Do not start session if new measured value is added over web API to avoid creation huge number of session files on server.
|
File size:
945 bytes
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | $WithoutSessionStart = true;
|
---|
4 | include_once('Application/Core.php');
|
---|
5 |
|
---|
6 | $Core = new Core();
|
---|
7 | $Core->ShowPage = false;
|
---|
8 | $Core->Run();
|
---|
9 |
|
---|
10 |
|
---|
11 | if(array_key_exists('MeasureId', $_GET) and array_key_exists('Value', $_GET))
|
---|
12 | {
|
---|
13 | $MeasureId = addslashes($_GET['MeasureId']);
|
---|
14 | $Value = addslashes($_GET['Value']);
|
---|
15 | if (array_key_exists('Time', $_GET)) $Time = $_GET['Time'] * 1;
|
---|
16 | else $Time = time();
|
---|
17 | $Measure = new Measure($Core->Database);
|
---|
18 | $Measure->Load($MeasureId);
|
---|
19 | $HostName = gethostbyaddr($_SERVER['REMOTE_ADDR']);
|
---|
20 | if(($HostName == $Measure->Data['PermissionAdd']) or ($_SERVER['REMOTE_ADDR'] == gethostbyname($Measure->Data['PermissionAdd'])))
|
---|
21 | {
|
---|
22 | $Measure->AddValue($Value, $Time);
|
---|
23 | echo('Hodnota '.$Value.' uložena');
|
---|
24 | } else echo('Nemáte oprávnění k aktualizaci zadané veličiny!<br>Vaše adresa: '.$HostName.'('.$_SERVER['REMOTE_ADDR'].')');
|
---|
25 | } else echo('Nebyly zadány potřebné parametry');
|
---|
Note:
See
TracBrowser
for help on using the repository browser.