<?session_start();
include("../opendb.php");
if($upd)
{
	if($ff !="none")
	{
   		$fl=$HTTP_POST_FILES['ff']['name'];
   		$file_dir=".";
  		$tmp_name=$_FILES['ff']['tmp_name'];
		print $fl;
   		move_uploaded_file($tmp_name,"./$file_dir/$ff_name") or die(' err:could not copy file');
  		print "=> File copied :".$fl."<br>";
	}
	$fp=fopen("./$file_dir/$ff_name","r") or die("Cant open file");
	$i=1;
	//include("opendb.php");
	$dt=date("Y-m-d H:i:s");
	while(!feof($fp))
	{
 		$line=fgets($fp,1024);
 		$spline=explode("\t",$line);
 		if(strlen($spline[0])>0)
 		{
 			$dd=explode('/',$spline[1]);
 			$dt1=$dd[2].'-'.$dd[1].'-'.$dd[0];
  			$sql="insert into compcust values('".addslashes($spline[0])."','".addslashes($spline[1])."','".addslashes(trim($spline[2])).
"','".addslashes(trim($spline[3]))."','".addslashes(trim($spline[4]))."','".addslashes(trim($spline[5])).
"','".addslashes(trim($spline[6]))."','".addslashes(trim($spline[7]))."','".addslashes(trim($spline[8])).
"','".addslashes(trim($spline[9]))."','".addslashes(trim($spline[10]))."','".addslashes(trim($spline[11])).
"','$brcode','".$dt."','$user')";
		//  print "<br>".$sql;
  			mysqli_query($db,$sql) or die(mysqli_error());
 		}
	}
	print "<script> alert('Done');</script>";
}
?>
<link rel="stylesheet" href="style.css" type="text/css" />
<style>
body,td{font-family:'arial narrow';letter-spacing:1;}
tr{background-color:c1d799}
.mnu{margin-left:5}
</style>
<center>
<br><br><br><br><br><br>
<form action='upldcust.php' method='post' ENCTYPE="multipart/form-data">
<table border=1>
<tr><td>
<table>
<th colspan=2>Upload Competetion Cust data
<tr><td>File </td><td><input type=file name='ff'></td></tr>
<tr><td><input type=submit value='Upload' name='upd'></td></tr>
</table>
</td></tr>
</table>
</form>
