Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2008
    Location
    MD, USA
    Posts
    65
    Thanks
    16
    Thanked 0 Times in 0 Posts

    Can I hide my email address for this form?

    Is there a way to make the HTML side of this form not display my email address? Is it possible to include the email address in the PHP script somehow? Sorry, total PHP beginner here. :P Need at least a point in the right direction..

    PHP (had to chop off most of it but I think the most relevant parts are here):

    Code:
    <?php
    $FM_VERS = "8.22";      // script version
    
    /* ex:set ts=4 sw=4 et:
     * FormMail PHP script from Tectite.com.  This script requires PHP 4 or later.
     * Copyright (c) 2001-2010 Root Software and Open Concepts (Vic) Pty Ltd
     * (ABN 12 130 429 248), Melbourne, Australia.
     * This script is free for all use as described in the "Copying and Use" and
     * "Warranty and Disclaimer" sections below.
     *
     * Visit us at http://www.tectite.com/ for updates and more information.
     *
     *** If you use Tectite FormMail, please support its development and other
     *** freeware products by putting the following link on your website:
     ***  Visit www.tectite.com for free <a href="http://www.tectite.com/">FormMail</a>.
     *
     * Author: Russell Robinson, 2nd October 2001
     *
     * Read This First
     * ~~~~~~~~~~~~~~~
     *  This script is very well documented and quite large!  It looks daunting,
     *  but really isn't.
     *  If you have experience with PHP or other scripting languages,
     *  here's what you *need* to read:
     *      - Configuration (TARGET_EMAIL & DEF_ALERT)
     *      - Creating Forms
     *  That's it!  (Alternatively, just read the Quick Start and/or
     *  Quicker Start section below).
     *  Full configuration documentation is here:
     *      http://www.tectite.com/fmdoc/index.php
     *
     *  NOTE: do not read or modify this script or any PHP script
     *  with DreamWeaver or FrontPage!
     *  Many versions of those programs silently corrupt PHP scripts.
     *
     * Purpose:
     * ~~~~~~~~
     *  To accept information from an HTML form via HTTP and mail it to recipients.
     *
     * What does this PHP script do?
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     *  On your web site, you may have one or more HTML forms that accept
     *  information from people visiting your website.  Your aim is for your
     *  website to email that information to you and/or add it to a database.
     *  FormMail performs those functions.
     *
     * Quick Start
     * ~~~~~~~~~~~
     *  1. Edit this file and set TARGET_EMAIL for your requirements (near
     *      line 256 in this file - replace "yourhost\.com" with your mail server's
     *      name).  We also strongly recommend you set DEF_ALERT (the next
     *      configuration below TARGET_EMAIL).
     *  2. Install this file as formmail.php (or other name ending in .php)
     *     on your web server.
     *     Test alerts by using your browser to open a URL to the script:
     *          http://www.yourhost.com/formmail.php?testalert=1
     *     Alerts are the only way FormMail can tell you the details of
     *     errors or faults.
     *  3. Create an HTML form and:
     *      - specify a hidden field called "recipients" with the email address
     *        of the person to receive the form's results.
     *      - in the your form tag set the action attribute to
     *        the formmail.php you uploaded to your web server
     *
     *  Once you have FormMail working, you may be interested in some advanced
     *  usage and features.  We have HOW-TO guides at www.tectite.com which
     *  describe many of the advanced processing you can do with FormMail.
     *      http://www.tectite.com/fmhowto/guides.php
     *
     * Quicker Start
     * ~~~~~~~~~~~~~
     *  Use the FormMail Configuration Wizard here:
     *      http://www.tectite.com/wizards/fmconf.php
     *  By answering a few questions you'll get a configured FormMail and
     *  a sample HTML form ready to upload and use on your server.
     *
     * Features
     * ~~~~~~~~
     *  For a list of features go to: http://www.tectite.com/formmailpage.php
     *
     * Security
     * ~~~~~~~~
     *  Security is the primary concern in accepting data from your website
     *  visitors.
     *  Tectite FormMail has several security features designed into it.  Note,
     *  however, it requires configuration for your particular web site.
     *
     * Configuration
     * ~~~~~~~~~~~~~
     *  To configure this script, go to the section titled "CONFIGURATION"
     *  (after reading the legal stuff below).
     *
     *  There is only one mandatory setting: TARGET_EMAIL
     *  and one strongly recommended setting: DEF_ALERT
     *
     *  Full configuration information is available here:
     *      http://www.tectite.com/fmdoc/index.php
     *
     * Creating Forms
     * ~~~~~~~~~~~~~~
     *  Go to this URL to learn how to write HTML forms for use with
     *  Tectite FormMail: http://www.tectite.com/fmdoc/creating_forms.php
     *
     * Copying and Use (Software License)
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     *  Tectite FormMail is provided free of charge and may be freely distributed
     *  and used provided that you:
     *      1. keep this header, including copyright and comments,
     *         in place and unmodified; and,
     *      2. do not charge a fee for distributing it, without an agreement
     *         in writing with Root Software allowing you to do so; and,
     *      3. if you modify FormMail before distributing it, you clearly
     *         identify:
     *              a) who you are
     *              b) how to contact you
     *              c) what changes you have made
     *              d) why you have made those changes.
     *
     *  By using any of our products, including this script, you are
     *  agreeing to our standard Terms and Conditions, available here:
     *      http://www.tectite.com/TermsAndConditions.pdf
     *
     *  This is free software and the Software License shown above
     *  is to be read in conjunction with our standard Terms and Conditions.
     *
     * Warranty and Disclaimer
     * ~~~~~~~~~~~~~~~~~~~~~~~
     *  Tectite FormMail is provided free-of-charge and with ABSOLUTELY NO WARRANTY.
     *  It has not been verified for use in critical applications, including,
     *  but not limited to, medicine, defense, aircraft, space exploration,
     *  or any other potentially dangerous activity.
     *
     *  By using Tectite FormMail you agree to indemnify Root Software and
     *  Open Concepts (Vic) Pty Ltd, their agents, employees, directors and
     *  associated companies and businesses from any liability whatsoever.
     *
     * We still care
     * ~~~~~~~~~~~~~
     *  If you find a bug or fault in FormMail, please report it to us.
     *  We will respond to your report and make endeavours to rectify any
     *  faults you've detected as soon as possible.
     *
     *  To contact us please register on our forums at:
     *      http://www.tectite.com/vbforums/
     *  or view our contact information:
     *      http://www.tectite.com/contacts.php
     *
     * Version History
     * ~~~~~~~~~~~~~~~
     *  Near the top of this file, you'll find its version. The version
     *  line looks like this:
     *       $FM_VERS = "N.MM";     /* script version ...
     *
     *  The version history used to be located within this file.  However,
     *  starting with Version 8.00 we've moved it...
     *
     *  You can read the complete version history of FormMail on our
     *  main website here:
     *   http://www.tectite.com/fmdoc/version_history.php
     */
    
        //
        // Capture the current date and time, for various purposes.
        //
    $lNow = time();
    
    ini_set('track_errors',1);          // enable $php_errormsg
    
    $aAlertInfo = array();
    $aPHPVERSION = array();
    
    $sLangID = "";                      // the language ID
    $aMessages = array();               // all FormMail messages in the appropriate
                                        // language
    
    $bUseOldVars = IsOldVersion($aPHPVERSION);
    
    if (!IsPHPAtLeast("5.3.0"))
            //
            // disable this silly setting (usually not enabled)
            // it's also deprecated from PHP version 5.3.0
            //
        set_magic_quotes_runtime(0);       
    
        //
        // seed the random number generate if not version 4.2.0 or later
        //
    if (!IsPHPAtLeast("4.2.0"))
        mt_srand(time());
    
        //
        // we set references to the appropriate arrays to handle PHP version differences
        // Session vars are selected after we start the session.
        //
    if ($bUseOldVars)
    {
        $aServerVars = &$HTTP_SERVER_VARS;
        $aGetVars = &$HTTP_GET_VARS;
        $aFormVars = &$HTTP_POST_VARS;
        $aFileVars = &$HTTP_POST_FILES;
        $aEnvVars = &$HTTP_ENV_VARS;
    }
    else
    {
        $aServerVars = &$_SERVER;
        $aGetVars = &$_GET;
        $aFormVars = &$_POST;
        $aFileVars = &$_FILES;
        $aEnvVars = &$_ENV;
    }
    $bIsGetMethod = false;
    
        //
        // If the form submission was using the GET method, switch to the
        // GET vars instead of the POST vars
        //
    if (isset($aServerVars["REQUEST_METHOD"]) && $aServerVars["REQUEST_METHOD"] === "GET")
    {
        $bIsGetMethod = true;
        if ($bUseOldVars)
            $aFormVars = &$HTTP_GET_VARS;
        else
            $aFormVars = &$_GET;
    }
    
    if (!isset($REAL_DOCUMENT_ROOT))
        SetRealDocumentRoot();
    
    if (isset($aServerVars['SERVER_PORT']))
        $SCHEME = ($aServerVars['SERVER_PORT'] == 80) ? "http://" : "https://";
    else
        $SCHEME = "";
    if (isset($aServerVars['SERVER_NAME']) && $aServerVars['SERVER_NAME'] !== "")
        $SERVER = $aServerVars['SERVER_NAME'];
    elseif (isset($aServerVars['SERVER_ADDR']) && $aServerVars['SERVER_ADDR'] !== "")
        $SERVER = $aServerVars['SERVER_ADDR'];
    else
        $SERVER = "";
    
    /*****************************************************************************/
    /* CONFIGURATION (do not alter this line in any way!!!)                      */
    /*****************************************************************************
     * This is the *only* place where you need to modify things to use formmail.php
     * on your particular system.  This section finishes at "END OF CONFIGURATION".
     * Help for all settings can be found on our website:
     *  http://www.tectite.com/fmdoc/index.php
     *
     * Also, above each setting is a direct URL to the help information for the
     * setting.
     *****************************************************************************/
    
                /* Help: http://www.tectite.com/fmdoc/email_name.php */
    define("EMAIL_NAME","^[-a-z0-9.]+");    // the '^' is an important security feature!
    
                /* Help: http://www.tectite.com/fmdoc/target_email.php */
    $TARGET_EMAIL = array(EMAIL_NAME."@mywebsite\.com$");
    
                /* Help: http://www.tectite.com/fmdoc/def_alert.php */
    define("DEF_ALERT","");
    
                /* Help: http://www.tectite.com/fmdoc/set_real_document_root.php */
    $SET_REAL_DOCUMENT_ROOT = "";       // overrides the value set by SetRealDocumentRoot function
    
        //
        // override $REAL_DOCUMENT_ROOT from the $SET_REAL_DOCUMENT_ROOT value (if any)
        // Do not alter the following code (next 3 lines)!
        //
    if (isset($SET_REAL_DOCUMENT_ROOT) && $SET_REAL_DOCUMENT_ROOT !== "")
        $REAL_DOCUMENT_ROOT = $SET_REAL_DOCUMENT_ROOT;
    
                /* Help: http://www.tectite.com/fmdoc/config_check.php */
    $CONFIG_CHECK = array("TARGET_EMAIL");
    
                /* Help: http://www.tectite.com/fmdoc/at_mangle.php */
    define("AT_MANGLE","");
    
                /* Help: http://www.tectite.com/fmdoc/target_urls.php */
    $TARGET_URLS = array();         // default; no URLs allowed
    
                /* Help: http://www.tectite.com/fmdoc/head_crlf.php */
    define("HEAD_CRLF","\r\n");
    
                /* Help: http://www.tectite.com/fmdoc/body_lf.php */
    define("BODY_LF","\r\n");       // the new default: use this for CR+LF
    //define("BODY_LF","\n");       // the old default: just LF
    
                /* Help: http://www.tectite.com/fmdoc/from_user.php */
    $FROM_USER = "";                            // the default - setting not used
    
                /* Help: http://www.tectite.com/fmdoc/sendmail_f_option.php */
    define("SENDMAIL_F_OPTION",false);
    define("SENDMAIL_F_OPTION_LINE",__LINE__-1);    // don't modify this line!
    
                /* Help: http://www.tectite.com/fmdoc/fixed_sender.php */
    $FIXED_SENDER = "";
    
                /* Help: http://www.tectite.com/fmdoc/set_sender_from_email.php */
    define("SET_SENDER_FROM_EMAIL",false);
    
                /* Help: http://www.tectite.com/fmdoc/ini_set_from.php */
    define("INI_SET_FROM",false);
    
                /* Help: http://www.tectite.com/fmdoc/logdir.php */
    $LOGDIR = "";                           // directory for log files; empty string to
                                            // disallow log files
                /* Help: http://www.tectite.com/fmdoc/autorespondlog.php */
    $AUTORESPONDLOG = "";           // file name in $LOGDIR for the auto responder
                                    // log; empty string for no auto responder log
    
                /* Help: http://www.tectite.com/fmdoc/csv_file_settings.php */
    $CSVDIR = "";                       // directory for csv files; empty string to
                                        // disallow csv files
    $CSVSEP = ",";      // comma separator between fields (columns)
    $CSVINTSEP = ";";   // semicolon is the separator for fields (columns)
                        // with multiple values (checkboxes, etc.)
    $CSVQUOTE = '"';    // all fields in the CSV are quoted with this character;
                        // default is double quote.  You can change it to
                        // single quote or leave it empty for no quotes.
    //$CSVQUOTE = "'";  // use this if you want single quotes
    $CSVOPEN = "";      // set to "b" to force line terminations to be
                        // kept as $CSVLINE setting below, regardless of
                        // operating system.  Keep as empty string and
                        // leave $CSVLINE unchanged, to get text file
                        // terminations for your server's operating system.
                        // (Line feed on UNIX, carriage-return line feed on Windows).
    $CSVLINE = "\n";    // line termination for CSV files.  The default is
                        // a single line feed, which may be modified for your
                        // server's operating system.  If you want to change
                        // this value, you *must* set $CSVOPEN = "b".
    
    [...whole lot more code here...]
    
    ?>
    HTML:

    Code:
    <form method="post" action="http://www.mywebsite.com/path/formmail.php" name="SampleForm">
                    <input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_USER">
                    <input type="hidden" name="recipients" value="steph@mywebsite.com" />
                    <input type="hidden" name="subject" value="Subject line" />
    
        			<table width="100%" border="0" id="form-container" cellpadding="0" cellspacing="0">
                         <tr>
                              <td valign="top" class="label-container"><label>Name:</label></td>
                         </tr>
                         <tr>
                              <td class="field-container"><input type="text" name="realname" class="field" id="Name" /></td>
                         </tr>
                         <tr>
                              <td valign="top" class="label-container"><label>Email Address:</label></td>
                         </tr>
                         <tr>
                              <td class="field-container"><input type="text" name="email" class="field" id="Email" /></td>
                         </tr>
                         <tr>
                              <td valign="top" class="label-container"><label>Phone:</label></td>
                         </tr>
                         <tr>
                              <td class="field-container"><input type="text" name="phone" class="field" id="Phone" /></td>
                         </tr>
                         <tr>
                              <td colspan="2">
                        <div class="btn-container">
                            <input type="submit" class="btn" name="submit" value="SUBMIT" />
                        </div>
                        </td>
                         </tr>
                    </table>
    </form>
    Thanks for any help on this, much appreciated.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Yeah... add $_POST['recipients'] = "your@emailaddress.com"; to the PHP script just before this line:

    PHP Code:
    $aFormVars = &$_POST
    Now there's no need for the hidden form input field.

    FYI, email collector bots scan this forum like crazy looking for emails to steal and sell to spammers so if I were you I would edit your first post and remove your actual email address from that html you posted. Actually I just looked at the email address you have in there and it appears you are smart and put a fake one in there

  • Users who have thanked Fumigator for this post:

    mssteph (03-05-2010)

  • #3
    New Coder
    Join Date
    Jul 2008
    Location
    MD, USA
    Posts
    65
    Thanks
    16
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fumigator View Post
    Yeah... add $_POST['recipients'] = "your@emailaddress.com"; to the PHP script just before this line:

    PHP Code:
    $aFormVars = &$_POST
    Now there's no need for the hidden form input field.

    FYI, email collector bots scan this forum like crazy looking for emails to steal and sell to spammers so if I were you I would edit your first post and remove your actual email address from that html you posted. Actually I just looked at the email address you have in there and it appears you are smart and put a fake one in there
    Worked.

    Marry me?

  • #4
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    I'll ask my wife

  • #5
    New Coder
    Join Date
    Jul 2008
    Location
    MD, USA
    Posts
    65
    Thanks
    16
    Thanked 0 Times in 0 Posts
    Damn!


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •