X-Git-Url: https://git.rvb.name/weathermon.git/blobdiff_plain/97f7c41a685adb43850c799f9f5ae3a9b38efd96..e7a2d1b901dbeb947e0ad605a53badc845e23ebc:/web/send.php diff --git a/web/send.php b/web/send.php new file mode 100644 index 0000000..7a69838 --- /dev/null +++ b/web/send.php @@ -0,0 +1,42 @@ + $valid_ip_end || $valid_ip_start > $client_ip) { + header('HTTP/1.1 403 Forbidden'); + echo "IP not in allowed range"; + exit; + } + + $stype = $_REQUEST['stype']; + $sid = $_REQUEST['sid']; + $param = $_REQUEST['param']; + $value = $_REQUEST['value']; + + $connection = new mysqli($mysql_host, $mysql_user, $mysql_pwd, $mysql_schema, $mysql_port); + if ($connection->connect_errno) { + header('HTTP/1.1 500 Internal Server Error'); + exit; + } + + $str = "CALL meteo.submit_value('".$stype."','".$sid."','".$param."',".$value.",NULL)"; + if (!$connection->query($str)) { + header('HTTP/1.1 500 Internal Server Error'); + exit; + } else { + $connection->commit(); +?> + +
+ +