1

以前にも投稿しましたが、詳しい情報が得られたので再度投稿したいと思います。私は、SiteMan を使用して構築された友人の Web ページの連絡先フォームの問題を解決する手助けをしようとしています。彼のページには、基本的な「連絡先」フォームと「見積もり依頼」フォームがあります。ページはmeadowwoodpedestals.comで、BlueHostでホストされています. これらのフォームは何年も機能していましたが、これらのフォームを介して送信されたメッセージを彼が受信していないことがわかりました. テストの結果、これらのページのいずれかで送信ボタンをクリックすると、確認画面が表示される代わりに空白の画面が表示され、メッセージが送信されないことがわかりました。彼が SiteMan エディタに変更を加えてから数か月が経ちました。

(1) ホストにサポートを依頼したところ、エラーは次の 2 つのページのページ コードに問題があることを示しているとのことでした。

スクリプト ヘッダーの早期終了: 500.php、リファラー: http://www.meadowwoodpedestals.com/content/index.php?page=quote

スクリプト ヘッダーの早期終了: 500.php、リファラー: http://www.meadowwoodpedestals.com/content/index.php?page=contact

応答は次のように述べています。ご覧のとおり、問題はコード自体にあるようです。これらの問題を解決するには、Web デザイナーまたはスクリプト スペシャリストに 2 つのページのコードを確認してもらう必要があります。(注:Webデザイナーは廃業しています)

(2) Bluehost フォーラム (これは Bluehost サイトです) で次の情報を見つけましたが、関連性があるかどうかわかりません。

「Bluehost サーバーでスクリプト ヘッダーが途中で終了するのは、CPU クォータ (またはメモリ?) が原因である可能性が高く、リソースの制限によりスクリプトが強制終了されました。」

(3) method="post" action="/cgi-bin/frmctact.php" を使用するお問い合わせフォームのページ コードを調べたところ、基本的な html はすべて問題ないように見えました。これについてはよくわかりません (その小さな十字記号を見たことがありませんか?):

<script type="text/javascript" language="javascript">  
function m_sfcon (u) {  
pre = "mail";  
url = pre + "to:" + u;  
document.location.href = url + "@meadowwoodpedestals.com";  
}†&lt;/script>  

(4) method="post" action="/cgi-bin/mail/mail.php" を使用する見積もりフォームのページ コードを見たところ、そのページにはスクリプト タグがまったくありません。

(5) 一連のコードを投稿せずに (何が役に立つのかよくわからないので)、これが私の考えです。

  • 同じエラーのページが 2 つあるので、quote.php と contact.php のどちらでも問題ないと思います。
  • 2 つのフォームは異なるアクションを使用するため、mail.php や frmctact.php ではないと推測しています。
  • ==> 2 つのページには何か共通点があるはずですが、それは何ですか?? 多分index.php?

(6) index.php を見て、php の開始タグをクリックすると、このステートメントの 6 行目のタグで終了しました ('si", の直前の ?>):

$adress = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);

include("data/page_header.php");
switch ($do) {
case "prevphp":
    if ($Siteman->mlevel >= 4) {
        echo preg_replace("'<\?php.*?\?>'si","",stripslashes($_POST["content"]));
    }
    break 1;

case "default":
    if ($info[2] == 1 || $Siteman->mlevel >= $info[2]) {
        include_once($content);
        if ($Siteman->mlevel < 5) {
            if ($page == "index") {
                if (substr_count($_SERVER["HTTP_REFERER"],$adress) == 0) {
                    echo "<script language=\"Javascript\" type=\"text/javascript\">
                    var res = screen.width.toString() + 'x' + screen.height.toString();
                    var referer = '" . urlencode($_SERVER["HTTP_REFERER"]) . "';
                    document.write('<img width=\"1\" height=\"1\" src=\"stats.php?new=1&amp;res=' + res +      '&amp;referer=' + referer + '\" id=\"stat\" name=\"stat\" />');
                    </script>";
                }
            }
        }
    }
    break 1;
}
include("data/page_footer.php");

?>

(なぜこのページがスペルミスのアドレスで機能するのかわかりません...)

cgi-bin/mail/mail.php と cgi-bin/frmctact.php の完全なコードをこのエリアに投稿する必要がありますか?

あらゆる/すべての助けに心から感謝します! アビー

編集 - ここに完全な frmctact.php があります - いくつかの空白行を削除し、警告を繰り返しました

    <?
    // ##########################################################################
    //
    //  DynaForm v1.4 - Created by the Webligo Group
    //                  http://www.webligo.com
    //
    //--> I deleted license text here

    // ###########################################################################
    // #### CONFIGURE FROM: ADDRESS ##############################################

    // If you would like to specify the From: address of emails sent by DynaForm,
    // enter it between the double quotes below. If you leave this blank, the
    // server will assign the default email address.

    $from_address = "info@meadowwoodpedestals.com";


    // ###########################################################################
    // #### ACTIVATE REQUIRED FIELDS? ############################################

    //
    // If you would like to make some fields of your form required, change "no" to
    // "yes" below.

    $required_on = "yes";

    // If you have set $required_on to "yes" above, you can make fields required
    // by beginning their name with "r_". For example, if you want to require
    // a user to enter their name, use the following HTML:
    //
    // <input type='text' name='r_Name'>
    //
    // If a user fails to enter a required field, they will be taken to a page
    // where a message such as "You have not completed all the required fields."
    // will be displayed. Please specify the URL to this file below:

    $required_errorpage = "/content/index.php?page=formerror";

    // ###########################################################################

    // #### OVERRIDE REQUIRED VARIABLES? #########################################

    //NOTE: THIS WILL NOT
    // AFFECT YOUR 'TURN ON REQUIRED FIELDS?' SECTION SETTINGS ABOVE.
    //
    // If you would like to override the three required variables in
    // order to hide your email address, email subject, and thank you page
    // URL from your email form, change "no" to "yes" below.

    $override = "yes";

    // If override is set to "yes", the hidden variables on your HTML
    // email form named "rec_mailto", "rec_subject", and "rec_thanks" will be
    // overridden and can therefore be removed from the form.

    // If you have set override to "yes" above, you must specify new values for
    // each of these variables below.

    // Enter the email address(es) to send the email to.
    $incoming_mailto = "info@meadowwoodpedestals.com";

    // Enter the email subject.
    $incoming_subject = "Website form";

    // Enter the thank you page URL.
    $incoming_thanks = "/content/index.php?page=formthanks";

    // ###########################################################################

    // #### BAN IP ADDRESSES? ####################################################
    //
    // If you would like to ban certain IP addresses from submitting your form,
    // change "no" to "yes" below.

    $ban_ip_on = "no";

    // If you have set $ban_ip_on to "yes" above, please enter a list of the
    // IP addresses you would like to ban, seperated only by commas.
    // An example has been provided below:

    $ban_ip_list = "111.222.33.55,11.33.777.99";

    // ###########################################################################

    // #### ACTIVATE DOMAIN SECURITY? ############################################

    //
    // This setting, when set to "yes" (default), will check to make sure other
    // people are not submitting data to your dynaform.php file from their
    // external domains. This means that if your domain name is "www.mysite.com",
    // only forms on "www.mysite.com" will be able to use this dynaform.php.
    // IF YOU ARE RECEIVING ERRORS SUCH AS "INVALID DOMAIN" FOR NO REASON, PLEASE
    // CHANGE "yes" TO "no" BELOW.

    $secure_domain_on = "no";

    // ###########################################################################

    // #### ACTIVATE AUTO-RESPONSE? ##############################################
    //
    //
    // This setting, when set to "yes", will make DynaForm automatically reply to
    // the user who submitted your form with an email message. If you would like
    // to use this feature, change "no" to "yes" below.

    $autorespond_on = "no";

    // If you have set $autorespond_on to "yes" above, you must specify a subject,
    // from-address, and message to include in the auto-response email.

    // The following setting is the subject of the auto-response email:
    $autorespond_subject = "Your Form Submission";

    // The following setting is the from-address of the auto-respond email:
    $autorespond_from = "youremail@yoursite.com";

    // The following setting is the message of your auto-response email:
    $autorespond_contents = "Your submission from our website has been received. Thank you!";

    // DynaForm also needs to know how to retrieve the user's email address.
    // You must specify the name of the field into which the user will enter
    // their email address. For example, if your email form contains an input
    // field like "<input type='text' name='Email'>" you would set the
    // following setting to "Email".
    $autorespond_mailto_field = "Email";

    // ###########################################################################


    // MAKE SURE DYNAFORM IS NOT BEING LOADED FROM THE URL
    if($HTTP_SERVER_VARS['REQUEST_METHOD'] == "GET") {
    echo "
    <html>
    <head><title>Webligo PHP DynaForm is installed correctly.</title></head>
    <body>
    <font style='font-family: verdana, arial; font-size: 9pt;'>
    <b>DynaForm is installed correctly.</b></font><br>
    <font style='font-family: verdana, arial; font-size: 8pt;'>
    DynaForm Easy PHP Form Mailer was created by <a href='http://www.webligo.com'>Webligo Developments</a>.
    </font>
    </body></html>
    ";
    exit();
    }

    // SET VARIABLES
    $incoming_fields = array_keys($HTTP_POST_VARS);
    $incoming_values = array_values($HTTP_POST_VARS);

    if($override == "no") {
    $incoming_mailto = @$HTTP_POST_VARS['rec_mailto'];
    $incoming_subject = @$HTTP_POST_VARS['rec_subject'];
    $incoming_thanks = @$HTTP_POST_VARS['rec_thanks'];
    }

    $incoming_mailto_cc = @$HTTP_POST_VARS['opt_mailto_cc'];
    $incoming_mailto_bcc = @$HTTP_POST_VARS['opt_mailto_bcc'];
    $form_url = @$HTTP_REFERER;

    // MAKE SURE DYNAFORM IS BEING RUN FROM THE RIGHT DOMAIN
    if($secure_domain_on == "yes") {
    $form_url_array = parse_url($form_url);
    $form_domain = $form_url_array[host];
    if($form_domain != $HTTP_SERVER_VARS[HTTP_HOST]) {
    echo "<h2>DynaForm Error - Invalid Domain</h2>
    You have accessed DynaForm from an external domain - this is not allowed.<br>
    You may only submit forms to a DynaForm file that exists on the same domain name.<br>
    If you believe to be receiving this message in error, please refer to your readme.txt file.
    <br><br>";
    $error = "yes";
    }
    }

    // CHECK IF MAILTO IS SET
    if($incoming_mailto == "") {
    echo "<h2>DynaForm Error - Missing Field</h2>
    Your form located at <a href='$form_url'>$form_url</a> does not work because you forgot to include
    the required \"<b>rec_mailto</b>\" field within the form. This field specifies who the email will
    be sent to.
    <br><br>
    This should look like:<br>
    &#060;input type=\"hidden\" name=\"rec_mailto\" value=\"youremail@yoursite.com\"&#062;
    <br><br>
    If you are still confused, please refer to the readme.txt for more information and examples.<br><br><br><br>
    ";
    $error = "yes";
    }

    // CHECK IF SUBJECT IS SET
    if($incoming_subject == "") {
    echo "<h2>DynaForm Error - Missing Field</h2>
    Your form located at <a href='$form_url'>$form_url</a> does not work because you forgot to include
    the required \"<b>rec_subject</b>\" field within the form. This field specifies the subject of
    the email that will be sent.
    <br><br>
    This should look like:<br>
    &#060;input type=\"hidden\" name=\"rec_subject\" value=\"New DynaForm Email\"&#062;
    <br><br>
    If you are still confused, please refer to the readme.txt for more information and examples.<br><br><br><br>
    ";
    $error = "yes";
    }

    // CHECK IF THANKS IS SET
    if($incoming_thanks == "") {
    echo "<h2>DynaForm Error - Missing Field</h2>
    Your form located at <a href='$form_url'>$form_url</a> does not work because you forgot to include
    the required \"<b>rec_thanks</b>\" field within the form. This field specifies what page the user
    will be taken to after they submit the form.
    <br><br>
    This should look like:<br>
    &#060;input type=\"hidden\" name=\"rec_thanks\" value=\"thanks.html\"&#062;
    <br><br>
    If you are still confused, please refer to the readme.txt for more information and examples.<br><br><br><br>
    ";
    $error = "yes";
    }

    // CHECK IF IP ADDRESS IS BANNED
    if($ban_ip_on == "yes") {

    if(strstr($ban_ip_list, $HTTP_SERVER_VARS[REMOTE_ADDR])) {
    echo "<h2>DynaForm Error - Banned IP</h2>
    You cannot use this form because your IP address has been banned by the administrator.<br>
    ";
    $error = "yes";
    }
    }


    if($error == "yes") {
    exit();
    }

    // SET EMAIL INTRODUCTION
    $message = "This email was received from your DynaForm located at $form_url \n\n";

    // LOAD EMAIL CONTENTS 
    for ($i = 0; $i < count($incoming_fields); $i++) { 
    if($incoming_fields[$i] != "rec_mailto") {
    if($incoming_fields[$i] != "rec_subject") {
    if($incoming_fields[$i] != "rec_thanks") {
    if($incoming_fields[$i] != "opt_mailto_cc") {
    if($incoming_fields[$i] != "opt_mailto_bcc") {

    // CHECK FOR REQUIRED FIELDS IF ACTIVATED
    if($required_on == "yes") {
    $sub = substr($incoming_fields[$i], 0, 2);
    if($sub == "r_") {
    if($incoming_values[$i] == "" OR !isset($incoming_values[$i]) OR $incoming_values[$i] == " ") {
    header("Location: $required_errorpage");
    exit();
    }}}

    // ADD FIELD TO OUTGOING MESSAGE
    $message .= "$incoming_fields[$i]:\n$incoming_values[$i]\n\n";
    }}}}}}

    // SET EMAIL FOOTER
    $message .= "\n\nEnd";

    // CLEAR HEADERS
    $headers = "";

    // ADD FROM ADDRESS
    if($from_address != "") {
    $headers .= "From: $from_address\r\n";
    }

    // CHECK FOR CC OR BCC
    if($incoming_mailto_cc != "") {
    $headers .= "Cc: $incoming_mailto_cc\r\n";
    }
    if($incoming_mailto_bcc != "") {
    $headers .= "Bcc: $incoming_mailto_bcc\r\n";
    }

    // SEND EMAIL
    mail($incoming_mailto, $incoming_subject, $message, $headers);

    // SEND AUTO-RESPONSE IF ACTIVATED
    if($autorespond_on == "yes") {
    $autorespond_mailto = @$HTTP_POST_VARS[$autorespond_mailto_field];
    $autorespond_headers = "From: $autorespond_from";
    mail($autorespond_mailto, $autorespond_subject, $autorespond_contents, $autorespond_headers);
    }

    // FORWARD TO THANK YOU PAGE
    header("Location: $incoming_thanks"); 


    ?>
4

1 に答える 1

0

500 エラーは、PHP がクラッシュしていることを意味します。Apache エラー ログ (bluehost の cpanel、IIRC にこのアイコンがあります) を調べる必要があり、PHP エラー メッセージが表示されることを願っています。

[人々は言う] 「リソースの制限により、スクリプトは強制終了されました。」

フォームを送信した直後に500エラーが発生するため、これではないと思います。

于 2011-09-07T04:45:04.180 に答える