SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2011
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Honey Pot results not working. I need a PHP nudge in the right direction.

    Hi Everyone

    I am trying to cobble together a contact form with a Honey Pot Spam protector. Newby here. Iím basing it off of the following link but I am trying to tweak it so that it will do what I want it to do.

    http://devgrow.com/simple-php-honey-pot/

    You can see the contact form here http://www.discovermassagespa.com/contact.html.

    Please do not look at the php code for http://www.discovermassagespa.com/contactus.php as I am changing that. Please refer to the following code.

    PHP Code:
    <?php








    /* Email Variables */



    $emailSubject 'The Massage Spa';



    $webMaster 'matt@webskillsplus.com';

    //$webMaster = 'info@discovermassagespa.com';

    //$webMaster = 'murrterr@rcn.com';



    /* Data Variables */


    $Name $_POST['Name'];

    $LastName $_POST['LastName'];

    $Email $_POST['Email'];

    $Area_Code $_POST['Area_Code'];

    $Phone_Prefix $_POST['Phone_Prefix'];

    $Line_Number $_POST['Line_Number'];

    $help $_POST['help'];

    if (isset(
    $_POST["submit"])) {
    echo 
    $_POST["when"];

    $robotest = <<<EOD


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <body>
     
     <p>This site is spam protected. If you are human please go back and try again.</p>
    <p>The Massage Spa Team.</p>

    </body>
    </html>


               
               EOD;
               echo "
    $robotest";
                

      } else {




               
          



    $body = <<<EOD

    \r\n \r\n <br>

    First Name: 
    $Name \r\n <br>

    Last Name: 
    $LastName \r\n <br>

    Email: 
    $Email \r\n <br>

    Phone: 
    $Area_Code $Phone_Prefix $Line_Number \r\n <br>

    How can we help you?: 
    $help \r\n <br>

    When: 
    $when \r\n <br>

    EOD;





    $from "From: info@discovermassagespa.com\r\n";

    $from .= "Reply-To: ".$Email."\r\n";

    $from .= "Content-type: text/html\r\n";



    mail($webMaster$emailSubject$body$from);

    /* Prepare autoresponder subject */
    $respond_subject "Thank you for contacting Massage Spa";

    /* Prepare autoresponder message */
    $respond_message "Thank you for contacting Massage Spa

    Someone will contact you soon.

    15966 Hickman Road, Clive Iowa 50325
    515.987.4593
    info@discovermassagespa.com

    Shop Hours: Mon-Fri 10am-9pm, Sa 9am-7pm, Su 11am-4pm 
    "
    ;

    $from "From: info@discovermassagespa.com\r\n";

    /* Send the message using mail() function */
    mail($Email$respond_subject$respond_message$from);





    /* Results rendered as HTML */




    $theResults = <<<EOD

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <body>
     
     <p>Thanks for contacting us.</p>
    <p>The Massage Spa Team.</p>

    </body>
    </html>

    EOD;

    echo 
    "$theResults";

    }

    ?>
    The following is the HTML and the CSS that is relevant to the Honey Pot.

    HTML Code:
    <p class="robotic" id="pot">
                <label>If you're human leave this blank:</label>
                <input name="robotest" type="text" id="robotest" class="robotest" /></p>
    Code:
    .robotic { 
      display: none;
    }
    Iím not sure what I am doing wrong. Thanks in advance for your help.

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    if (isset($_POST["submit"])) {

    <input name="robotest" type="text" id="robotest" class="robotest" /></p>

    PS: You cannot have indentations in HEREDOC string closures. The first character on the line must be the "E" in "EOD;" (tabs count as characters).
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2011
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your help. I am so green at this stuff. But I am learning quickly.

    I made some changes but I am still having some issues.

    PHP Code:
    <?php 








    /* Email Variables */ 



    $emailSubject 'The Massage Spa'



    $webMaster 'matt@webskillsplus.com'

    //$webMaster = 'info@discovermassagespa.com'; 

    //$webMaster = 'murrterr@rcn.com'; 



    /* Data Variables */ 


    $Name $_POST['Name']; 

    $LastName $_POST['LastName']; 

    $Email $_POST['Email']; 

    $Area_Code $_POST['Area_Code']; 

    $Phone_Prefix $_POST['Phone_Prefix']; 

    $Line_Number $_POST['Line_Number']; 

    $help $_POST['help']; 

    if (isset(
    $_POST["submit"])) { 
    echo 
    htmlentities($_POST['when']); 

    $robotest = <<<EOD 


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
    <
    html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
    <
    head
    <
    title>Massage Spa was created with whole body health and wellness in mind. </title

    </
    head
    <
    body

       <
    h1 class="homeheader">If you are a spam robot please go away.</h1
       
    </
    body
    </
    html

    EOD;echo "$robotest"
                 

      } else { 




                
           



    $body = <<<EOD 

    \r\\r\<br

    First Name$Name \r\<br

    Last Name$LastName \r\<br

    Email$Email \r\<br

    Phone$Area_Code $Phone_Prefix $Line_Number \r\<br

    How can we help you?: $help \r\<br

    When$when \r\<br

    EOD




    $from "From: info@discovermassagespa.com\r\n"

    $from .= "Reply-To: ".$Email."\r\n"

    $from .= "Content-type: text/html\r\n"



    mail($webMaster$emailSubject$body$from); 

    /* Prepare autoresponder subject */ 
    $respond_subject "Thank you for contacting Massage Spa"

    /* Prepare autoresponder message */ 
    $respond_message "Thank you for contacting Massage Spa 

    Someone will contact you soon. 

    15966 Hickman Road, Clive Iowa 50325 
    515.987.4593 
    info@discovermassagespa.com 

    Shop Hours: Mon-Fri 10am-9pm, Sa 9am-7pm, Su 11am-4pm 
    "


    $from "From: info@discovermassagespa.com\r\n"

    /* Send the message using mail() function */ 
    mail($Email$respond_subject$respond_message$from); 





    /* Results rendered as HTML */ 




    $theResults = <<<EOD 

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
    <
    html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
    <
    head
    <
    title>Massage Spa was created with whole body health and wellness in mind. </title
    <
    meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

    </
    head
    <
    body

       <
    h1 class="homeheader">Thank you for contacting Massage Spa</h1
       
          <
    p>Someone will be in touch with you soon.</p
          <
    p>The Massage Spa Team.</p
         
    </
    body
    </
    html

    EOD
    echo 
    "$theResults"



    ?>
    A couple of things are happening.

    It appears

    PHP Code:
    $robotest = <<<EOD 
    is failing. I tested the honey pot and filled it out like a robot. it completely ignores it and renders (if that is the right word) the html page that says "Someone will be in touch with you soon". It will send the results of the field to the right email (success) however the auto responder is not working as well.

    Any ideas?


Bookmarks

Posting Permissions

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