<html>
<head>
<style>
.em{
font-weight:bold;
background-color:aqua;
}
.normal{
font-weight:normal;
background-color:#ffffff;
}
</style>

<title>add_flight_time002_ins3.php</title>

<?php
/**
* ????????????????CSV??????????
* @param resource handle
* @param int length
* @param string delimiter
* @param string enclosure
* @return ??????????????????????FALSE??????
*/
function fgetcsv_reg (&$handle, $length = null, $d = ',', $e = '"') {
$d = preg_quote($d);
$e = preg_quote($e);
$_line = "";
while ($eof != true) {
$_line .= (empty($length) ? fgets($handle) : fgets($handle, $length));
$itemcnt = preg_match_all('/'.$e.'/', $_line, $dummy);
if ($itemcnt % 2 == 0) $eof = true;
}
$_csv_line = preg_replace('/(?:\r\n|[\r\n])?$/', $d, trim($_line));
$_csv_pattern = '/('.$e.'[^'.$e.']*(?:'.$e.$e.'[^'.$e.']*)*'.$e.'|[^'.$d.']*)'.$d.'/';
preg_match_all($_csv_pattern, $_csv_line, $_csv_matches);
$_csv_data = $_csv_matches[1];
for($_csv_i=0;$_csv_i<count($_csv_data);$_csv_i++){
$_csv_data[$_csv_i]=preg_replace('/^'.$e.'(.*)'.$e.'$/s','$1',$_csv_data[$_csv_i]);
$_csv_data[$_csv_i]=str_replace($e.$e, $e, $_csv_data[$_csv_i]);
}
return empty($_line) ? false : $_csv_data;
}
?>

</head>

<body>
<h1>add_flight_time002_ins3.php</h1>
????????
<h3>???????????????????????????</h3>
<p>???????</p>
<p>fputcsv($data1,Array($dep_plc,$arr_plc,$dep_time,$arr_time,$airline));?
<strong>$tmp=implode(&quot;,&quot;,$_POST);
fwrite($data1,$tmp.&quot;\r\n&quot;);</strong>????????</p>

 

<h3>?????????</h3>

<form action="add_flight_time002_ins3.php" method="post">
????<input type="text" name="dep_place"><br />
????<input type="text" name="arr_place"><br />
?????<input type="text" name="dep_time"><br />
?????<input type="text" name="arr_time"><br />
?????<input type="text" name="airline" maxlength="3"><br />
<input type="reset" value="???">&nbsp;<input type="submit" value="??">
</form>

<?php
//?????????????????????????????????????????
$dep_plc = htmlspecialchars($_POST['dep_place']);
$arr_plc = htmlspecialchars($_POST['arr_place']);
$dep_time = htmlspecialchars($_POST['dep_time']);
$arr_time = htmlspecialchars($_POST['arr_time']);
$airline = htmlspecialchars($_POST['airline']);

if($dep_plc!="" && $arr_plc!="" && $dep_time!="" && $arr_time!="" && $airline!=""){
$fname = 'add_flight_time002.txt';

//'a'????????????????????
$data1 = @fopen($fname,'a') or exit('???????????????</body></html>');

//fputcsv($data1,Array($dep_plc,$arr_plc,$dep_time,$arr_time,$airline));
$tmp=implode(",",$_POST);
fwrite($data1,$tmp."\r\n");

}else{
echo "?????????";
}

?>

</body>
</html>