Ver código fonte

Update 'post-esp-data.php'

master
Santhosh Reddy Lotla 2 anos atrás
pai
commit
b4a628fb62
1 arquivos alterados com 9 adições e 13 exclusões
  1. +9
    -13
      post-esp-data.php

+ 9
- 13
post-esp-data.php Ver arquivo

@@ -1,29 +1,26 @@
<?php
$servername = "localhost";
$username = "root";
$password = "";
$username = "u488983909_neonflake";
$password = "Tony@1234";
$dbname = "datasensor";


$conn = mysqli_connect($servername, $username, $password, $dbname);

$api_key_value = "ideogen";
$api_key_value = "Neonflake0799";

$api_key = $Tank1 = $Tank2 = $rainwater = $Turbidity = $pH_sensor= "";
$api_key = $temperature = $luminosity = $pH= "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
$api_key = test_input($_POST["api_key"]);
if($api_key == $api_key_value) {
$Tank1 = test_input($_POST["Tank1"]);
$Tank2 = test_input($_POST["Tank2"]);
$rainwater = test_input($_POST["rainwater"]);
$Turbidity = test_input($_POST["Turbidity"]);
$pH_sensor = test_input($_POST["pH_sensor"]);
$Temp = test_input($_POST["temperature"]);
$Lumi = test_input($_POST["luminosity"]);
$ph = test_input($_POST["pH"]);
$sql = "INSERT INTO sensordata ( Tank1, Tank2, rainwater, Turbidity,pH_sensor)
VALUES ('" . $Tank1 . "', '" . $Tank2 . "', '" . $rainwater . "', '" . $Turbidity . "', '" . $pH_sensor . "')";
$sql = "INSERT INTO espdata ( Temperature, Luminosity, pH)
VALUES ('" . $Temp . "', '" . $Lumi . "', '" . $ph . "')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
@@ -37,7 +34,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
else {
echo "Wrong API Key provided.";
}

}
else {
echo "No data posted with HTTP POST.";


Carregando…
Cancelar
Salvar