'.$query.'
'.mysql_error()); if(mysql_num_rows($result)==0) return 0; $row = mysql_fetch_row($result); return $row[0]; } $unityHash = anti_injection_login($_POST["hash"]); $phpHash = "ascidie12:"; // same code in here as in your Unity game if ($unityHash == $phpHash){ // CONNECTIONS ========================================================= $host = "localhost"; //put your host here $user = "root"; //in general is root $password = "root"; //use your password here $dbname = "virtualembryo"; //your database $link=mysql_connect($host, $user, $password) or die("Cant connect into database"); mysql_select_db($dbname)or die("Cant connect into database"); if(isset($_POST["upload"])){ //Query on the Upload $upload=intval($_POST["upload"]); if($upload==0){//New data time Insertion .... $file=$_FILES['UPLOAD_'.$_POST["id_upload"].'-'.$_POST["t"].'_txt']; $query = 'INSERT INTO upload_time (id_upload,t,field) VALUES ('.$_POST["id_upload"].','.$_POST["t"].',"'.file_get_contents($file['tmp_name']).'")'; $result = mysql_query($query); if (!$result) echoUTF($query); } if($upload==1){//New Upload $now=new DateTime(); $query = 'INSERT INTO upload (id_people, filename,date, type) VALUES ('.$_POST["id_people"].',"'.$_POST["filename"].'","'.$now->format('Y-m-d h:s:i').'",'.$_POST["type"].')'; $result = mysql_query($query); if (!$result) echoUTF('Error : ' . mysql_error()); else echo mysql_insert_id(); } if($upload==2){// Update numberof Cells and minV and maxV $SQL = 'UPDATE upload SET nbCell="'.$_POST["nbCell"].'" ,minV="'.$_POST["minV"].'" ,maxV="'.$_POST["maxV"].'" WHERE id='.$_POST["id_upload"]; $result = mysql_query($SQL); if (!$result) echoUTF('Error : ' . mysql_error()); } if($upload==3){//Get Upload LIST $query = 'SELECT id,filename,date,type,nbCell,minV,maxV from upload WHERE id_people='.$_POST["id_people"]; $result = mysql_query($query); if (!$result) echoUTF('Error : ' . mysql_error()); else { $rows = array(); while($r = mysql_fetch_row($result)) { $rows[] = $r; } print jsonRemoveUnicodeSequences($rows); } } if($upload==4){// Delete dataset $SQL = 'DELETE FROM upload WHERE id='.$_POST["id_upload"]; $result = mysql_query($SQL); if (!$result) echoUTF('Error : ' . mysql_error()); $query = 'DELETE FROM upload_time WHERE id_upload='.$_POST["id_upload"]; $result = mysql_query($query); if (!$result) echoUTF('Error : ' . $query); } if($upload==5){//Get Upload Dataset time step + step $query = 'SELECT field from upload_time WHERE id_upload='.$_POST["id_upload"].' AND t='.$_POST["t"]; $result = mysql_query($query); if (!$result) echoUTF('Error : ' . mysql_error()); else { $row = mysql_fetch_row($result); echo ($row[0]); } } } } } ?>