<?
session_start();
include("../opendb.php");
$fp=fopen("all.txt","r") or die("Cant open file");
$i=1;
mysqli_query($db,"delete from oldinvoice");

while(!feof($fp))
{
 $line=fgets($fp,1024);
 $spline=explode("#",$line);
 if(strlen($spline[2])>0)
 {
  $dt1=explode('/',$spline[0]);
  $dt=trim($dt1[2]).'-'.trim($dt1[1]).'-'.trim($dt1[0]);

  $sql="insert into oldinvoice values('$dt','$spline[1]','".addslashes(trim($spline[2])).
"','$spline[3]','".addslashes(trim($spline[4]))."','".addslashes(trim($spline[5])).
"','$spline[6]','$spline[7]','$spline[8]','$spline[9]','$spline[10]','$spline[11]',
'$spline[12]','','Aut141')";

print ". ";

  mysqli_query($db,$sql) or die(mysqli_error());
 }
}
print "<script alert('Done'); </script>";
?>
