2 require_once 'config_local.php';
5 $client_ip = $_SERVER["REMOTE_ADDR"];
7 if ((strpos($client_ip, "192.168.") === 0) || (strpos($client_ip, "10.8.") === 0) || (strpos($client_ip, "2001:470:6f:9d5:") === 0)) {
21 header('HTTP/1.1 403 Forbidden');
22 echo "IP not in allowed range";
27 $stype = $_REQUEST['stype'];
28 $sid = $_REQUEST['sid'];
29 $param = $_REQUEST['param'];
30 $value = $_REQUEST['value'];
32 if (isset($_REQUEST['time'])) {
34 $timestamp = "'".$_REQUEST['time']."'";
44 $connection = new mysqli($mysql_host, $mysql_user, $mysql_pwd, $mysql_schema, $mysql_port);
45 if ($connection->connect_errno) {
46 header('HTTP/1.1 500 Internal Server Error');
50 $str = "CALL meteo.submit_value('".$stype."','".$sid."','".$param."',".$value.",".$timestamp.")";
51 if (!$connection->query($str)) {
52 header('HTTP/1.1 500 Internal Server Error');
57 $connection->commit();