MBED HTTP client with web pages for server
Dependencies: DS1820
Fork of J_HTTP_Client by
ForServer/nucleoin.php
- Committer:
- JohnnyK
- Date:
- 2018-05-23
- Revision:
- 1:920482bc63f4
- Parent:
- 0:d90e1f7bda1f
File content as of revision 1:920482bc63f4:
<?php $server = "sql.someweb.com"; // Here you place your MySQL server address $user = "johnybravo"; // Here you place your user name of your MySQL $pass = "bravo"; // Here you place your password of your MySQL $db = "dtb"; // Here you place your name of your DTB $mysql = mysql_connect($server, $user, $pass); // Connect to MySQL mysql_select_db($db); // Select DTB of MySQL if(!$mysql) { die("Unable connect to server!"); } $doSql = mysql_query('SELECT * FROM nucleo_data WHERE id=1'); if(mysql_num_rows($doSql) == 0){ mysql_query('INSERT INTO nucleo_data (id, time, date, temp) VALUES (1, '.date("H:i:s",time()).', '.date("Y-m-d",time()).', 0)'); } if($mysql and isset($_GET['temp'])){ $temp = sanitize($_GET['temp']); $sqll = 'UPDATE nucleo_data SET temp="'.$temp.'", time="'.date("H:i:s",time()).'", date="'.date("Y-m-d",time()).'" WHERE id=1'; $doSqll = mysql_query($sqll); if($doSqll){ echo 'Zapis byl uspesny'; } else{ die('Invalid query: ' . mysql_error()); } } function sanitize($input){ $input = htmlspecialchars($input); $input = htmlentities($input); $input = strip_tags($input); $input = trim($input); return $input; } ?>