/    Sign up×
Community /Pin to ProfileBookmark

Need your help, please


——————————————————————————–

I’m trying to modify the mail form script.

I’m not the php knower.

Please, someone, add only few lines to that script that it works as I need:

The script operates but I need to include some additional functions:

1) when the user submit the form his IP address would be included in the message sent to administrator;

2) there is auto-response function in the script. and if it’s terned on the auto-response text will be sent to the user. I need that the script adds auto-response htm (+pics) file. AND one more: since the script will be used on several pages – the file should be certain for certain page:

  • from1.htm+mailscript.php=> sends 1.html (+jpg)

  • from2.htm+mailscript.php=> sends 2.html (+jpg)
  • ————————FORM—————————
    <form action=”mailscript.php ” method=”POST” target=”_self” name=”myform”>
    <b>* Your e-mail, please:</b>
    <input type=’text’ size=20 name=’r_Email’>
    <input type=”submit” value=”Submit”>
    </form>
    ———————–end—————————

    to post a comment
    PHP

    1 Comments(s)

    Copy linkTweet thisAlerts:
    @Io_CanauthorJun 26.2004 — 

    ------------------script mailscript.php begins------------------------------

    <?



    // If you want the From: address to be the email address of the user who

    // submitted your form, use $from_address = "$_POST[Email]";

    // Make sure "Email" is the name of the text field where users enter their

    // email address on your form.

    $from_address = "$_POST[Email]";


    $required_on = "yes";

    $required_errorpage = "error.htm";


    // #### OVERRIDE REQUIRED VARIABLES?

    $override = "yes";

    $incoming_mailto = "[email protected]";

    $incoming_subject = "Send me your news, please";

    $incoming_thanks

    = "http://www.russianpaintings.net/forms/leaveemail/thanks.htm";

    // #### BAN IP ADDRESSES?

    $ban_ip_on = "no";

    $ban_ip_list = "111.222.33.55,11.33.777.99";


    // #### ACTIVATE DOMAIN SECURITY?

    $secure_domain_on = "yes";

    // #### ACTIVATE AUTO-RESPONSE?

    $autorespond_on = "yes";

    $autorespond_from = "[email protected]";

    // The following setting is the message of your auto-response email:

    $autorespond_contents = "Somebody, may be you, have submitted your e-mail address to the news mailing list on the website www.RUSSIANPAINTINGS.NET. n n You will receive the news letters from us soon. n n To unsubscribe from the news letters, please, send the letter to [email][email protected][/email] with the 'UNSUBSCRIBE ME' subject.n n Administration of the Russian Paintings Gallery.";

    $autorespond_mailto_field = "r_Email";

    // MAKE SURE DYNAFORM IS NOT BEING LOADED FROM THE URL

    if($HTTP_SERVER_VARS['REQUEST_METHOD'] == "GET") {

    echo "

    <html>

    <head><title>Rusian Paintings Gallery</title></head>

    <body>

    <font style='font-family: verdana, arial; font-size: 9pt;'>

    <b>Russan Paintngs Galery www.RUSSIANPAINTINGS.net</b></font><br>

    </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 PHP 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 our subbmission form from an external domain - this is not allowed.<br>

    You may only submit forms to us on our site <b>http://www.russianpaintings.net</b><br>;

    <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="[email protected]"&#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>Russian Paitings PHP 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="http://www.russianpaintings.net/forms/leaveemail/thanks.htm"&#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>Russian Paintings Gallery 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 = "n From: $form_url nn The sender of this leter wants to be included in the news mailing list. nn";

    // 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]nn";

    }}}}}}

    // SET EMAIL FOOTER

    $message .= "nnEnd of the message";

    // CLEAR HEADERS

    $headers = "";

    // ADD FROM ADDRESS

    if($from_address != "") {

    $headers .= "From: $from_addressrn";

    }

    // CHECK FOR CC OR BCC

    if($incoming_mailto_cc != "") {

    $headers .= "Cc: $incoming_mailto_ccrn";

    }

    if($incoming_mailto_bcc != "") {

    $headers .= "Bcc: $incoming_mailto_bccrn";

    }

    // 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");


    ?>

    -----------------END of the mail script-------------------

    ×

    Success!

    Help @Io_Can spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...