出错内容如下:Notice: Undefined variable: topic in c:\program files\easyphp1-8\www\test\test5.php on line 10Notice: Undefined index: PHP_SELF in c:\program files\easyphp1-8\www\test\test5.php on line 29 method=post>
有form的,但是按了提交键后。变成Forbidden You don't have permission to access /test/<br on this server. --------------------------------------------------------------------------------Apache/1.3.33 Server at localhost Port 80
You don't have permission to access /test/<br on this server.
--------------------------------------------------------------------------------Apache/1.3.33 Server at localhost Port 80
改为:
$fp = fopen($tmpfilename, "w+");
看看.
--------------------
<? echo($GLOBALS["PHP_SELF"]); ?>
有这样输出的吗?
<? echo $GLOBALS["PHP_SELF"] ; ?>
<html>
<head>
<title>意见信箱</title>
</head>
<body>
<?/*重新定义全局变量*/
@reset($_POST);
while (list ($key_p, $val_p) = each ($_POST))
{
$val_p=Trim($val_p);
global $$key_p;
$$key_p=$val_p;
}
$mailto="[email protected]";if (($topic!="") and ($Email!="") and ($body!="")) {
$tmpfilename = tempnam("/tmp", "dm");
$fp = fopen($tmpfilename, "w"); fwrite($fp, "From: ".$Email."\n");
fwrite($fp, "Subject: ".$topic." <访客来信>\n\n");
fwrite($fp, $body."\n\n");
fwrite($fp, "送信人:".$sender."\n");
fwrite($fp, "发信IP:".$REMOTE_ADDR."\n");
fclose($fp); $execstr="cat ".$tmpfilename." | /usr/lib/sendmail ".$mailto;
exec($execstr); $execstr="echo $sender $REMOTE_HOST >> /var/log/mail.log";
exec($execstr);
echo "信件已送出!!本站工作人员尽快处理您的问题<p><br><br><br><br><br>";
} else {
?>
<form action="" method="post">
<table border=0>
<tr><td>主题</td><td><input type=text size=20 name=topic></tr>
<tr><td>姓名</td><td><input type=text size=20 name=sender></tr>
<tr><td>Email</td><td><input type=text size=20 name=Email></tr>
<tr><td colspan=2>内容<br><textarea cols=26 rows=10 name=body></textarea></td></tr>
<tr><td colspan=2><div align=right><input type=submit value="送出"></td></tr>
</table>
</form>
<?
}
?>
</body>
</html>