Advertisement
Guest User

Untitled

a guest
Dec 18th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.22 KB | None | 0 0
  1. <?php
  2. $servername = "mysql.hostinger.ru";
  3. $username = "u761866288_rut";
  4. $password = "jamaica123";
  5. $dbname = "u761866288_db";
  6.  
  7.  
  8. date_default_timezone_set('Europe/Riga');
  9. $date = date('m/d/Y H:i:s');
  10.  
  11. // Create connection
  12. $conn = new mysqli($servername, $username, $password, $dbname);
  13. // Check connection
  14. if ($conn->connect_error) {
  15.     die("Connection failed: " . $conn->connect_error);
  16. }
  17.  
  18. if($_GET['i'] == "")
  19. {
  20. echo "No Data!";
  21. }
  22. else
  23. {
  24.  
  25. $t1 = htmlspecialchars($_GET["a"]);
  26. $h1 = htmlspecialchars($_GET["b"]);
  27. $wt1 = htmlspecialchars($_GET["c"]);
  28. $wd1 = htmlspecialchars($_GET["d"]);
  29. $wt2 = htmlspecialchars($_GET["e"]);
  30. $wd2 = htmlspecialchars($_GET["f"]);
  31. $ph = htmlspecialchars($_GET["g"]);
  32. $ppm = htmlspecialchars($_GET["h"]);
  33. $light = htmlspecialchars($_GET["i"]);
  34. $fan1 = htmlspecialchars($_GET["j"]);
  35. $ram = htmlspecialchars($_GET["k"]);
  36.  
  37.  
  38.  
  39. $sql = "INSERT INTO data (time, temp1, humi1, wt, wd, wt2, wd2, ph, ppm, light, fan1, ram)
  40. VALUES ('$date', '$t1', '$h1', '$wt1', '$wd1', '$wt2', '$wd2', '$ph', '$ppm', '$light', '$fan1', '$ram')";
  41.  
  42.  
  43. if ($conn->query($sql) === TRUE)
  44.  
  45. {
  46.     echo "Error: " . $sql . "<br>" .
  47. }
  48.  
  49. else
  50. {
  51.     echo "Error: " . $sql . "<br>" .
  52. }
  53.  
  54. $conn->close();
  55.  
  56. }
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement