- Timestamp:
- Feb 24, 2019, 10:02:57 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/add.php
r75 r87 8 8 $Core->Run(); 9 9 10 $AddedValues = 0; 11 12 // Try to load single value 13 $Time = time(); 10 14 if(array_key_exists('MeasureId', $_GET) and array_key_exists('Value', $_GET)) 11 15 { 12 $MeasureId = addslashes($_GET['MeasureId']);13 $Value = addslashes($_GET['Value']);14 16 if (array_key_exists('Time', $_GET)) $Time = $_GET['Time'] * 1; 15 else $Time = time(); 17 AddValue(addslashes($_GET['MeasureId']), addslashes($_GET['Value']), $Time); 18 $AddedValues = $AddedValues + 1; 19 } 20 21 // Try to load multiple values 22 $Time = time(); 23 $I = 1; 24 while (array_key_exists('MeasureId'.$I, $_GET) and array_key_exists('Value'.$I, $_GET)) 25 { 26 if (array_key_exists('Time'.$I, $_GET)) $Time = $_GET['Time'.$I] * 1; 27 AddValue(addslashes($_GET['MeasureId'.$I]), addslashes($_GET['Value'.$I]), $Time); 28 $AddedValues = $AddedValues + 1; 29 $I++; 30 } 31 32 if ($AddedValues == 0) echo('Nebyly zadány potřebné parametry MeasureId a Value.'."\n"); 33 34 function AddValue($MeasureId, $Value, $Time) 35 { 36 global $Core; 37 16 38 $Measure = new Measure($Core->Database); 17 39 $Measure->Load($MeasureId); … … 20 42 { 21 43 $Measure->AddValue($Value, $Time); 22 echo('Hodnota '.$Value.' uložena' );23 } else echo('Nemáte oprávnění k aktualizaci zadané veličiny!<br>Vaše adresa: '.$HostName.'('.$_SERVER['REMOTE_ADDR'].')' );24 } else echo('Nebyly zadány potřebné parametry');44 echo('Hodnota '.$Value.' uložena'."\n"); 45 } else echo('Nemáte oprávnění k aktualizaci zadané veličiny!<br>Vaše adresa: '.$HostName.'('.$_SERVER['REMOTE_ADDR'].')'."\n"); 46 }
Note:
See TracChangeset
for help on using the changeset viewer.