"; echo"ACK "; $t = date("H:i:s"); if(!empty($_POST['key'])) { $key = $_POST['key']; } if(!empty($_POST['bat'])) { $bat = $_POST['bat']; } if(!empty($_POST['ver'])) { $ver = $_POST['ver']; } if(!empty($_POST['nb'])) { $nb = $_POST['nb']; } if(!empty($_POST['p'])) { $p = $_POST['p']; } if(!empty($_POST['tt'])) { $tt = $_POST['tt']; } if(!empty($_POST['tm'])) { $tm = $_POST['tm']; } if(!empty($_POST['ts'])) { $ts = $_POST['ts']; } if(!empty($_POST['com'])) { $com = $_POST['com']; } if(!empty($_POST['datax'])) { $datax = $_POST['datax']; } if(!empty($_POST['datay'])) { $datay = $_POST['datay']; } if(!empty($_POST['result'])) { $result = $_POST['result']; } if(!empty($_POST['Tmp'])) { $Tmp = $_POST['Tmp']; } // MAC=CC:50:E3:C7:35:96&key=3d6b&bat=50&ver=1.6&nb=0&p=0&tt=0.00&tm=0.00 //if(!empty($_POST['MAC'])&&($key==$key2)) { $mac = $_POST['MAC']; //$mac = "8C:AA:B5:74:98:BB"; // calcul de la clé $k1 = hexdec(substr($mac,0,2)); $k2 = hexdec(substr($mac,3,2)); $k3 = hexdec(substr($mac,6,2)); $k4 = hexdec(substr($mac,9,2)); $k5 = hexdec(substr($mac,12,2)); $k6 = hexdec(substr($mac,15,2)); $key2 = dechex(($k1 ^ $k3 ^ $k6 ^ 20)*256 + ($k2 ^ $k4 ^ $k5 ^ 165)); //echo $key." ".$key2; if(!empty($_POST['MAC'])&&($key==$key2)) { //echo 'mac='.$mac.chr(13).chr(10); $filename = "/var/www/ArcherTrainer/AT/AT.txt"; $chaine=file_get_contents($filename); $pos=strpos($chaine,$mac); if ($pos>0) { //echo $pos.chr(13).chr(10); $pos2=strpos($chaine,chr(13),$pos); //echo $pos2.chr(13).chr(10); $id = substr($chaine,$pos+18,$pos2-$pos-18); } else { $id = "AT_".substr($mac,12,2).substr($mac,15,2); $fp = fopen($filename,"a+"); fputs($fp, $mac.','.$id.chr(13)); fclose($fp); mkdir('/var/www/ArcherTrainer/AT/'.$mac, 0777, true); $ligne = ""; $filename = "/var/www/ArcherTrainer/AT/".$mac."/".date("Y-m-d"); $fp = fopen($filename,"a+"); fputs($fp, $ligne); fclose($fp); } echo 'id='.$id.chr(13).chr(10); $txt = '<-- '.$mac.','.$ip.','.$d.','.$t.' -->'; require("t.php"); // update suivi.txt $ligne = " MAC=".$mac.",id=".$id.",Date=".date("d-m-Y H:i:s").",key=".$key.",bat=".$bat.",ver=".$ver.",Tmp=".$Tmp.",nb=".$nb.",p=".$p.",tt=".$tt.",tm=".$tm.",ts=".$ts.",com=".$com.",".chr(13).chr(10); $filename = "/var/www/ArcherTrainer/suivi.txt"; $fp = fopen($filename,"a+"); fputs($fp, $ligne); fclose($fp); if(!empty($_POST['datax'])) { $filename = "/var/www/ArcherTrainer/AT/".$mac."/".date("Y-m-d"); $chaine2=file_get_contents($filename); $nb = substr_count($chaine2, 'datax') + 1; /// correction du nombre de fleche // update AT dir if (!is_dir('/var/www/ArcherTrainer/AT/'.$mac)) { mkdir('/var/www/ArcherTrainer/AT/'.$mac, 0777, true); } $ligne = " MAC=".$mac.",id=".$id.",Date=".date("d-m-Y H:i:s").",key=".$key.",bat=".$bat.",ver=".$ver.",Tmp=".$Tmp.",nb=".$nb.",p=".$p.",tt=".$tt.",tm=".$tm.",ts=".$ts.",com=".$com.",datax=".$datax.chr(13).chr(10); $filename = "/var/www/ArcherTrainer/AT/".$mac."/".date("Y-m-d"); $fp = fopen($filename,"a+"); fputs($fp, $ligne); fclose($fp); include("run_stat.php"); } echo " ok"; } ?>