1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
<?php
//fichier 'tcphdr.php'
function vider_tabl($table_a_vider){
$sql = "TRUNCATE TABLE ".$table_a_vider;
if(mysql_query($sql)){
// SUCCES
// echo "La table ".$table_a_vider." a été vidée !";
$path = 'lognat.txt';
$contents = file_get_contents($path);
$contents = explode("\n", $contents);
for ($i=0; $i<count($contents); $i++){
// echo $contents[$i].'<br/>';
$seq[$i] = substr($contents[$i],196,9);
// echo $seq[$i].'<br/>';
$req = "INSERT INTO tcphdr (tcp_seq) VALUES('$seq[$i]')";
mysql_query($req);
} }
else
// ECHEC
echo "La table ".$table_a_vider." n'a pas été vidée de son contenu.";
}
?> |
Partager