2
私は、PHPについて(そして間違いなく、一般的にはWeb開発/)にはn00bですが、私はコードを比較するとかなりの例を見てきました。私はそれを理解できませんでる。基本的に起こっていることは、contact.phpファイルがちょうど私のコンピュータにダウンロードされているということです。 ugh。また、このクライアントはフィールドの検証を求めなかったため、そこには存在しません。助けて!!なぜこのphpの連絡フォームはcontact.phpをダウンロードしますか?
HERESに私のHTML-
<form action="contact.php" method="post">
<fieldset>
<legend><strong>Get A Quote!</strong>
</legend>
Call me at 555-555-5555, or email me at <a href="">[email protected]</a>, or use the form below.<br /><br />
<div class="clearfix">
<div class="input">
<input style="width:370px; height:35px; font-size:14px;" value="Name" name="name" size="50" type="text">
</div>
</div><!-- /clearfix -->
<div class="clearfix">
<div class="input">
<input style="width:370px; height:35px; font-size:14px;" value="Email" name="email" size="50" type="text">
</div>
</div><!-- /clearfix -->
<div class="clearfix">
<div class="input">
<input style="width:370px; height:35px; font-size:14px;" value="Phone" name="phone" size="50" type="text">
</div>
</div><!-- /clearfix -->
<div class="clearfix">
<div class="input">
<textarea style="width:370px; height:55px; font-size:14px;" name="message" size="50" type="text">Message</textarea>
</div>
</div><!-- /clearfix -->
</fieldset>
<button type="submit" name="saveForm" style="background-image: url(static/img/btn-submit.png); width:150px; height:37px;"></button>
</form>
とphp-
<?php
if(isset($_POST['saveForm'])) {
$to = "[email protected]";
$subject = "Inquiry from website";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$phone_field = $_POST['phone'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
mail($to, $subject, $body);
} else {
echo "Sorry, something went wrong. Please email me at [email protected]";
}
?>
あなたはこのPHPが実行されているサーバーにインストールされている100%ですか? BTW:少なくとも基本レベルで検証する必要があります。それ以外の場合は、スクリプトを使用して(メールヘッダーの注入によって)SPAMを送信する他の人には脆弱です。 – middus
[FastCGI](http://www.fastcgi.com/drupal/)や他の方法でPHPを実行していますか? PHPコンテンツを実行するためのサーバー構成はどのようなものですか? – sarnold
ちなみに、あなたの設定で['suhosin.mail.protect'](http://www.hardened-php.net/suhosin/configuration.html#suhosin.mail.protect)が有効になっていたら人々が虐待するのは簡単すぎるでしょう。 – sarnold