Contact Form Problem

Discussion in 'Programming' started by akamrdr, Apr 11, 2010.

?

Grape Drink or Purple Drink?

  1. Grape Drink

    66.7%
  2. Purple Drink

    33.3%
  1. #1
    Problem: I built a website with a contact form so people can fill it out and I send them a Free Quote back to them. But heres the problem. When I tested it from my computer, it worked just fine. I revived the email in a matter of seconds. But when I asked a friend to fill it out and send it, I never revived it.
    Here are the codes.

    Can anyone help me out here?

    <td style="padding-left: 10px;"><form action="freequote.php" method="post">
    								<table border="0" cellpadding="8" cellspacing="8" summary="feedback form">
    <tr><td><label for="tswname">Name</label>:</td><td><input type="text" name="fullname" id="tswname" size="25" /></td></tr>
    <tr><td><label for="tswemail">Email address</label>:</td><td><input type="text" id="tswemail" name="email" size="25" /></td></tr>
    <tr>
    <td colspan="2">
    <label for="tswcomments">Description Of Website &amp; Price Range:</label>
    <br />
    <textarea rows="7" cols="45" name="comments" id="tswcomments"></textarea>
    </td>
    </tr>
    <tr>
    <td align="center" colspan="2">
    <input type="submit" value="Free Quote" />
    <br /></td>
    </tr>
    </table>
    </form>
    HTML:
    <?php
    /*
        CHFEEDBACK.PHP Feedback Form PHP Script Ver 2.15.0
        Generated by thesitewizard.com's Feedback Form Wizard 2.15.0.
        Copyright 2000-2009 by Christopher Heng. All rights reserved.
        thesitewizard is a trademark of Christopher Heng.
    
        Get the latest version, free, from:
            http://www.thesitewizard.com/wizards/feedbackform.shtml
    
    	You can read the Frequently Asked Questions (FAQ) at:
    		http://www.thesitewizard.com/wizards/faq.shtml
    	
    	I can be contacted at:
    		http://www.thesitewizard.com/feedback.php
    	Note that I do not normally respond to questions that have
    	already been answered in the FAQ, so *please* read the FAQ.
    
        LICENCE TERMS
        
        1. You may use this script on your website, with or
        without modifications, free of charge.
        
        2. You may NOT distribute or republish this script,
        whether modified or not. The script can only be
        distributed by the author, Christopher Heng.
        
        3. THE SCRIPT AND ITS DOCUMENTATION ARE PROVIDED
        "AS IS", WITHOUT WARRANTY OF ANY KIND, NOT EVEN THE
        IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A
        PARTICULAR PURPOSE. YOU AGREE TO BEAR ALL RISKS AND
        LIABILITIES ARISING FROM THE USE OF THE SCRIPT,
        ITS DOCUMENTATION AND THE INFORMATION PROVIDED BY THE
        SCRIPTS AND THE DOCUMENTATION.
    
        If you cannot agree to any of the above conditions, you
        may not use the script. 
        
        Although it is not required, I would be most grateful
        if you could also link to thesitewizard.com at:
    
           http://www.thesitewizard.com/
    
    */
    
    // ------------- CONFIGURABLE SECTION ------------------------
    
    // $mailto - set to the email address you want the form
    // sent to, eg
    //$mailto		= "youremailaddress@example.com" ;
    
    $mailto = 'akamrdr@gmail.com' ;
    
    // $subject - set to the Subject line of the email, eg
    //$subject	= "Feedback Form" ;
    
    $subject = "Contact Us" ;
    
    // the pages to be displayed, eg
    //$formurl		= "http://www.example.com/feedback.html" ;
    //$errorurl		= "http://www.example.com/error.html" ;
    //$thankyouurl	= "http://www.example.com/thankyou.html" ;
    
    $formurl = "http://drwebservice.freevar.com/FreeQuote.html" ;
    $errorurl = "http://google.com" ;
    $thankyouurl = "http://drwebservice.freevar.com/thankyou.html" ;
    
    $email_is_required = 1;
    $name_is_required = 1;
    $comments_is_required = 1;
    $uself = 0;
    $use_envsender = 0;
    $use_sendmailfrom = 1;
    $use_webmaster_email_for_from = 0;
    $use_utf8 = 1;
    $my_recaptcha_private_key = '' ;
    
    // -------------------- END OF CONFIGURABLE SECTION ---------------
    
    $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
    $content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ;
    if (!isset( $use_envsender )) { $use_envsender = 0 ; }
    if (isset( $use_sendmailfrom ) && $use_sendmailfrom) {
    	ini_set( 'sendmail_from', $mailto );
    }
    $envsender = "-f$mailto" ;
    $fullname = (isset($_POST['fullname']))? $_POST['fullname'] : $_POST['name'] ;
    $email = $_POST['email'] ;
    $comments = $_POST['comments'] ;
    $http_referrer = getenv( "HTTP_REFERER" );
    
    if (!isset($_POST['email'])) {
    	header( "Location: $formurl" );
    	exit ;
    }
    if (($email_is_required && (empty($email) || !preg_match('/@/', $email))) || ($name_is_required && empty($fullname)) || ($comments_is_required && empty($comments))) {
    	header( "Location: $errorurl" );
    	exit ;
    }
    if ( preg_match( "/[\r\n]/", $fullname ) || preg_match( "/[\r\n]/", $email ) ) {
    	header( "Location: $errorurl" );
    	exit ;
    }
    if (strlen( $my_recaptcha_private_key )) {
    	require_once( 'recaptchalib.php' );
    	$resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
    	if (!$resp->is_valid) {
    		header( "Location: $errorurl" );
    		exit ;
    	}
    }
    if (empty($email)) {
    	$email = $mailto ;
    }
    $fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ;
    
    if (function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc()) {
    	$comments = stripslashes( $comments );
    }
    
    $messageproper =
    	"This message was sent from:\n" .
    	"$http_referrer\n" .
    	"------------------------------------------------------------\n" .
    	"Name of sender: $fullname\n" .
    	"Email of sender: $email\n" .
    	"------------------------- COMMENTS -------------------------\n\n" .
    	$comments .
    	"\n\n------------------------------------------------------------\n" ;
    
    $headers =
    	"From: \"$fullname\" <$fromemail>" . $headersep . "Reply-To: \"$fullname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.15.0" .
    	$headersep . 'MIME-Version: 1.0' . $headersep . $content_type ;
    
    if ($use_envsender) {
    	mail($mailto, $subject, $messageproper, $headers, $envsender );
    }
    else {
    	mail($mailto, $subject, $messageproper, $headers );
    }
    header( "Location: $thankyouurl" );
    exit ;
    
    ?>
    
    PHP:
    Thanks alot
    AkAmrdr
    Dr.Design

     
    akamrdr, Apr 11, 2010 IP
  2. Sbhedges

    Sbhedges Peon

    Messages:
    57
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Seems quite simple. Although it might not make a difference it's worth trying.

    Change :
    
    
    $mailto = 'akamrdr@gmail.com' ;
    Code (markup):
    TO :
    
    
    $mailto = "akamrdr@gmail.com" ;
    Code (markup):
    I reckon the error most likely has something to do with sendmail_from in php.ini

    Stupid question, did your friend fill out the Recaptcha correctly ?

    Definatley Grape by the way
     
    Sbhedges, Apr 11, 2010 IP
  3. akamrdr

    akamrdr Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I set it to where there is no captcha

    and what do u mean it might have something to do with sendmail_from?

    Im gonna change that code, is there anyway u could test it for me?
    drwebservice.freevar.com
    Thanks for the help, i will see if it works if u can test it for me, thanks


     
    akamrdr, Apr 11, 2010 IP