0
phpで私は電子メールを "email.txt"に送信する連絡フォームを作成しました。唯一の問題は、誰でも "example.com/email.txt"というURLの文書を見ることができることです。LAMPサーバーのファイルを保護する方法は?
このような私のPHPコードを見て:
<!DOCTYPE html>
<html>
<head></head>
<body>
<?PHP
$email = $_POST["emailaddress"];
$to = "[email protected]";
$subject = "New Email Address for Mailing List";
$headers = "From: $email\n";
$message = "A visitor to your site has sent the following email address to be added to your mailing list.\n
Email Address: $email";
$user = "$email";
$usersubject = "Thank You";
$userheaders = "From: [email protected]\n";
$usermessage = "Thank you for subscribing to our mailing list.";
mail($to,$subject,$message,$headers);
mail($user,$usersubject,$usermessage,$userheaders);
$fh = fopen("email.txt", "a");
fwrite($fh, $email);
fclose($fh);
?>
<html>
<body>
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<div align="center">Thank You, Your Information Has Been Submitted</div>
</td>
</tr>
</table>
</body>
</html>
</body>
</html>
誰でも今私は、ドキュメントを保護することができますどのように?