vi posto tutto il codice di import.php
forse ci capiamo meglio
import.php
<html>
<head>
<title>Username</title>
<meta http-equiv=\"Refresh\" content=\"0; url=contatti.php?login=$username\">
</head>
<body link="#000000" vlink="#000000" alink="#000000">
<div align="left">
<table border="0" width="890" height="32" bgcolor="#E9E9E9">
<tr>
<td width="890" height="32"><font face="Arial" size="1"> | <font color="#000000">Contatti</font> |
<font color="#000000">Assistenza |
<font color="#000000">Gestione Dati |
<font color="#000000">Report |
<font color="#000000">Import |
Login : <? echo "<font color =green>$username </font>"; ?>
<? echo "<font size=1 face=arial>$data </p>"; ?></font>
</font></td>
</tr>
</table>
</div>
<p align="left"><font size="1" face="Arial">[img]IMAGE/quadro1.bmp[/img]
IMPORT FILE REPORT</font></p>
<p align="left"><font size="1" face="Arial">Import File</font></p>
<form method ="post" action = "import.php?login=<? echo $username; ?>">
<table border="1" width="642" height="43" bgcolor="#E9E9E9" bordercolor="#E9E9E9" style="border-left-style: solid">
<tr>
<td width="921" height="43" align="left" bordercolor="#E9E9E9" bgcolor="#E9E9E9" style="border-right-style: solid"><font face="Arial" size="1">Seleziona
il file :</font> <input type="file" name="file" size="27" style="font-family: Arial; font-size: 8 pt; font-weight: bold"> </td>
<td width="338" height="43" align="left" bordercolor="#E9E9E9" bgcolor="#E9E9E9" style="border-left-style: solid">
<p align="right"></td>
</tr>
<tr>
<td width="921" height="44" align="left" bordercolor="#E9E9E9" bgcolor="#E9E9E9" style="border-right-style: solid">
<input type="submit" value="Invia" name="B1" style="font-family: Arial; font-size: 8 pt; font-weight: bold">
<input type="reset" value="Reset" name="B2" style="font-family: Arial; font-size: 8 pt; font-weight: bold"> </td>
<td width="338" height="44" align="left" bordercolor="#E9E9E9" bgcolor="#E9E9E9" style="border-left-style: solid"></td>
</tr>
</table>
</form>
<p align="left"><font size="1" face="Arial">[img]IMAGE/quadro1.bmp[/img]
GESTIONE FILE</font></p>
<?php
$data = date ("d - m - Y");
$username = $_GET ["login"];
include ("dbconnect.php");
$nomefile = $_POST ['file'];
$submit= $_POST ["B1"];
if ($submit == 'Invia')
{
echo "<font face=arial size=1> Il file che si sta importando è questo : $nomefile </font>
";
$handle = fopen($nomefile, "a");
fclose($handle);
$records = file ($nomefile);
$numero = count($records);
for($x = 0; $x < $numero; ++$x)
{
$records[$x] = trim($records[$x]);
$dati = explode ("|",$records[$x]);
//echo $dati;
list($first,$first_debit,$first_credit,$second,$se cond_debit,$second_credit,$third,
$third_debit,$third_credit,$target_resort,$trx_des k,$market_code,$business_format_date,
$business_time,$guest_full_name,$business_date,$re ference,$trx_no,$cashier_debit,
$cashier_credit,$room,$credit_card_supplement,$cur rencyone,$trx_code,
$cashier_id,$remark,$insert_user,$insert_date,$che que_number,$room_class,
$cc_code,$cashier_name,$exp_reciept_no,$user_name, $second_det,$third_det,$cash_id_user_name,
$print_cashier_debit,$print_cashier_credit) = $dati;
echo "
";
if ($business_format_date == "" and $business_time == "" and $guest_full_name == "" and $reference == "" and
$cashier_debit == "" and $room == "" )
{
echo "";
}
else
{
if ($room == "9500")
echo "<img src = \"image\arancio.gif\"> <font face=arial size=1 color=red>LOST</font> <font face=arial size=1>Data :$business_format_date Ora :$business_time Ospite :$guest_full_name
Addebito :$reference Importo :$cashier_debit Camera :$room
</font>";
else
echo "<font face=arial size=1>Data :$business_format_date Ora :$business_time Ospite :$guest_full_name
Addebito :$reference Importo :$cashier_debit Camera :$room
</font>";
}
$arrPippo = split( ":", $reference);
$pippo = trim($arrPippo[0]);
$pippo1 = substr($pippo,1);
//echo $pippo1;
}
echo "<form method=post action=insert.php?login=$username>";
echo "<input type=\"hidden\" name=\"data\" value=\"$business_format_date\">";
?>
<input type="submit" value="Salva" name="B2" style="font-family: Arial; font-size: 8 pt; font-weight: bold">
</form>
<?php
//chiusura if submit primo
}
else
{
}
?>
</body>
</html>