-1
使用以下腳本將信息發送到平面文件,並且它一直運行,直到引入驗證。在支架上出現分析錯誤{在線23上。 破損的可能原因是什麼?驗證介紹中斷腳本
<?php
// we must never forget to start the session
session_start();
?>
<html>
<head>
<title>Form to Flat File</title>
</head>
<body>
<?php
$vname = $_GET["visitor"];
$vemail = $_GET["visitormail"];
$vphone = $_GET["visitorphone"];
$ip = $_SERVER['REMOTE_ADDR'];
$httpref = $_SERVER['HTTP_REFERER'];
$httpagent = $_SERVER['HTTP_USER_AGENT'];
$todayis = date("l, F j, Y, g:i a") ;
// VALIDATION INTRODUCTION - THESE ARE THE FORM FIELDS THAT WE REQUIRED THE VISITOR TO FILL IN
if(empty($vname)
|| empty($vemail)
|| empty($vphone)
{ //Parse error: parse error in C:\wamp\www\Poll\DRBPoll\RaffleInfo.php on line 23
echo "<h2>Go Back and fill in all fields </h2>\n";
echo '<a href="javascript:history.go(-1)"><h3>Go Back to the Raffle Form</h3></a><br />'; /*GO BACK BUTTON*/
die ("Use the Go Back to Raffle Form button !! ");
}
if(!$vemail == "" && (!strstr($vemail,"@") || !strstr($vemail,".")))
{
echo "<h2>Go Back and enter a valid E-mail Address</h2>\n";
echo '<a href="javascript:history.go(-1)"><h3>Go Back to the Raffle Form</h3></a><br />'; /*GO BACK BUTTON*/
die ("Use the Go Back to Raffle Form button !!");
}
// THANK YOU MESSAGE IS WORKING
print("<b>Thank You!</b><br />Your information will be entered once into the raffle!");
$out = fopen("savedinfo.php", "a");
if (!$out) {
print("Could not add detail to Raffle file! Please contact the Webmaster");
exit;
}
//OUTPUTS TO THE FLATFILE IS WORKING
fputs ($out, "\n");
fwrite($out,"$todayis [IST], $vname, $vemail, $vphone, $ip, $httpref, $httpagent.");
fclose($out);
?>
</body>
</html>