A je to! / Mbed OS J_HTTP_Client

Dependencies:   DS1820

Fork of J_HTTP_Client by Jan Kamidra

Revision:
0:d90e1f7bda1f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ForServer/nucleoin.php	Sun May 13 16:31:13 2018 +0000
@@ -0,0 +1,41 @@
+<?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;
+	}
+?>
\ No newline at end of file