www.webdeveloper.com
Results 1 to 2 of 2

Thread: Hide my email address in this php file...

  1. #1
    Join Date
    Feb 2005
    Location
    Watford, Hertfordshire.
    Posts
    22

    Question Hide my email address in this php file...

    Hello,

    I have the following code in a php file communicating with a contact form on a webpage, what i want to do is to hide my e-mail address in the php file so it some what prevents spam bots finding my address. Does anyone know what code i need to add so the php works to send the information from a form at the same time preventing spam bots ambushing me with spam?? Many thanks.



    <?php


    $EmailTo = "info@beechroofing.com";

    $Subject = "Contact From The Website!";

    $EmailFrom = Trim(stripslashes($_POST['full_name']));

    $email_address = Trim(stripslashes($_POST['email_address']));

    $tel_number = Trim(stripslashes($_POST['tel_number']));

    $day = Trim(stripslashes($_POST['day']));

    $month = Trim(stripslashes($_POST['month']));

    $year = Trim(stripslashes($_POST['year']));

    $start_time = Trim(stripslashes($_POST['start_time']));

    $end_time = Trim(stripslashes($_POST['end_time']));
    $event_type = Trim(stripslashes($_POST['event_type']));
    $venue = Trim(stripslashes($_POST['venue']));
    $music = Trim(stripslashes($_POST['music']));
    $guests = Trim(stripslashes($_POST['guests']));
    $additional_info = Trim(stripslashes($_POST['additional_info']));
    $hear_about_us = Trim(stripslashes($_POST['hear_about_us']));



    $validationOK=true;

    if (Trim($full_name)=="") $validationOK=false;

    if (Trim($email_address)=="") $validationOK=false;

    if (Trim($tel_number)=="") $validationOK=false;

    if (Trim($day)=="") $validationOK=false;

    if (!$validationOK) {

    print "<meta http-equiv=\"refresh\" content=\"0;URL=goback.htm\">";

    exit;


    }


    $Body = "";

    $Body .= "Full Name: ";

    $Body .= $full_name;

    $Body .= "\n";

    $Body .= "E-Mail Address: ";

    $Body .= $email_address;

    $Body .= "\n";

    $Body .= "Tel Number: ";

    $Body .= $tel_number;

    $Body .= "\n";

    $Body .= "Day: ";

    $Body .= $day;

    $Body .= "\n";

    $Body .= "Month: ";

    $Body .= $month;

    $Body .= "\n";

    $Body .= "Year: ";

    $Body .= $year;

    $Body .= "\n";

    $Body .= "Start Time: ";

    $Body .= $start_time;

    $Body .= "\n";

    $Body .= "End Time: ";

    $Body .= $end_time;

    $Body .= "\n";
    $Body .= "Event Type: ";

    $Body .= $event_type;

    $Body .= "\n";
    $Body .= "Venue: ";

    $Body .= $venue;

    $Body .= "\n";
    $Body .= "Music Expectations: ";

    $Body .= $music;

    $Body .= "\n";
    $Body .= "Guests: ";

    $Body .= $guests;

    $Body .= "\n";
    $Body .= "Additional Info: ";

    $Body .= $additional_info;

    $Body .= "\n";
    $Body .= "Hear About Us: ";

    $Body .= $hear_about_us;

    $Body .= "\n";



    $success = mail($EmailTo, $Subject, $Body, "From: <$Email>");


    if ($success){

    print "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.htm\">";

    }

    else{

    print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";

    }

    ?>

  2. #2
    Join Date
    Sep 2010
    Location
    England
    Posts
    36
    PHP is a server-side language your email address should be safe from bots as is.
    Peter Kelly
    PHP Tutorials & Personal Portfolio
    http://www.peter-kelly.me
    Company-Host.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles