Weather-Watch.com
September 02, 2010, 05:33:11 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Members: 8,509  Posts: 362,030  Topics: 40,113
Please welcome lawrencerebeiro, our newest member.

Latest versions: WD - 10.37P  WDL - 6.05  MML - 1.03
 News:
Check out the new FAQs (Frequently Asked Questions) board for a growing list of hints, tips and diagnostic suggestions.
  Advanced Search
   Home   Bug Tracker Photo Gallery Wiki Chat Calendar Search Login Register Help  
Pages: 1 2 3 [4] 5 6 ... 14
  Print  |  « previous  |  next »  |  Go Down  
Author Topic: Free Contact Form PHP Script with image captcha - contact.php  (Read 28446 times)
0 Members and 1 Guest are viewing this topic.
dafuser
Weather Guru
**
Offline Offline

Location: Granbury, Texas
Station Type: Davis Vantage Vue
Posts: 529
Local Time: Thursday 21:33



WWW
« Reply #45 on: August 15, 2008, 06:34:13 PM »

I wanted to see the error to ensure I wasn't getting the same thing.  I saw the error your getting and I do not get that with my contact form v1.08.  Did you actually receive the test message I sent?

I see you have your contact form external from your regular site.  If you need help getting it integrated let me know...
Thanks, I already added it to the templates and call it from the "Contact Us" link in the footer. I was just using the plain contact.php for esting. Everythings workng fine. Great script.
Logged

--
Thanks Les...
Microsoft Windows: Proof that P.T. Barnum was correct.

24 inch iMac 2.8GHz C2D, 4 GB Ram (OS X 10.6.3 Snow Leopard) Davis Vantage Vue
mth
Rain Maker
***
Offline Offline

Location: Baltimore, Maryland
Station Type: Davis Vantage Pro 2 - Model 6153
Posts: 1,258
Local Time: Thursday 14:33



WWW
« Reply #46 on: August 15, 2008, 09:10:58 PM »

Mike,

I keep getting an "input forbidden" message when I try to test the script.
I've got this running here:
http://69.143.90.55/webfiles/wxcontact2.php

Michael
« Last Edit: August 15, 2008, 09:27:01 PM by mth » Logged

Michael Holden
Relay, Maryland Weather Station
http://www.relayweather.com

MCHALLIS
Rain Maker
***
Offline Offline

Location: Long Beach, WA USA
Station Type: Davis VP2+
Posts: 1,997
Local Time: Thursday 11:33



WWW
« Reply #47 on: August 15, 2008, 09:22:05 PM »

Mike,

I keep getting an "input forbidden" message when I try to test the script.
I've got this running here:
http://69.143.90.55/webfiles/wxcontact2.php

Michael
Probably because of your host domain does not match. You can set it correctly or disable that with a setting

 // Site Domain without the http://www like this: $domain = 'carmosaic.com';
 $domain = 'yoursite.com';

 // Make sure the form was posted from your host name only.
 // SET  $domain_protect =1; for ON,  $domain_protect = 0; for OFF.
 // this is a security feature to prevent spammers from posting from files hosted on other domain names
 // "Input Forbidden" message will result if host does not match
 $domain_protect = 1;
Logged

mth
Rain Maker
***
Offline Offline

Location: Baltimore, Maryland
Station Type: Davis Vantage Pro 2 - Model 6153
Posts: 1,258
Local Time: Thursday 14:33



WWW
« Reply #48 on: August 15, 2008, 09:26:43 PM »

Mike,

I changed the "$domain_protect" to 0 and now I am getting a PHP error when i fill in the form and click send:   Fatal error: Call to undefined function getmxrr() in C:\wdisplay\webfiles\wxcontact2.php on line 648

I'm a little embarrased as it seems everyone else is not having issues.  Embarassed

Michael
« Last Edit: August 15, 2008, 09:28:19 PM by mth » Logged

Michael Holden
Relay, Maryland Weather Station
http://www.relayweather.com

MCHALLIS
Rain Maker
***
Offline Offline

Location: Long Beach, WA USA
Station Type: Davis VP2+
Posts: 1,997
Local Time: Thursday 11:33



WWW
« Reply #49 on: August 15, 2008, 09:34:19 PM »

Mike,

I changed the "$domain_protect" to 0 and now I am getting a PHP error when i fill in the form and click send:   Fatal error: Call to undefined function getmxrr() in C:\wdisplay\webfiles\wxcontact2.php on line 648

I'm a little embarrased as it seems everyone else is not having issues.  Embarassed

Michael

Your php does not support the getmxrr function

Try this:

replace:
Code:
function ctf_validate_email($email) {
   // Create the syntactical validation regular expression
   $regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";
   // Presume that the email is invalid
   $valid = 0;
   //check for all the non-printable codes in the standard ASCII set,
   //including null bytes and newlines, and exit immediately if any are found.
   if (preg_match("/[\\000-\\037]/",$email)) {
    return 0;
   }
   // Validate the syntax
   if (eregi($regexp, $email)) {
      list($username,$domaintld) = split("@",$email);
      // Validate the domain
      if (getmxrr($domaintld,$mxrecords)) {
         $valid = 1;
      }
   } else {
      $valid = 0;
   }
   return $valid;
}


with this:
Code:
function ctf_validate_email($email) {
   // Create the syntactical validation regular expression
   $regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";
   // Presume that the email is invalid
   $valid = 0;
   //check for all the non-printable codes in the standard ASCII set,
   //including null bytes and newlines, and exit immediately if any are found.
   if (preg_match("/[\\000-\\037]/",$email)) {
    return 0;
   }
   // Validate the syntax
   if (eregi($regexp, $email)) {
      list($username,$domaintld) = split("@",$email);
      // Validate the domain
      if ( function_exists("getmxrr") ) {
        if (getmxrr($domaintld,$mxrecords) ) {
             $valid = 1;
        }
      } else {
             $valid = 1;
      }
   } else {
      $valid = 0;
   }
   return $valid;
}

let me know how it goes, if that makes it work, I will put that in the next release.
« Last Edit: August 15, 2008, 09:58:43 PM by MCHALLIS » Logged

NorCal Dan
-= Dan =-
Senior Weather Controller
*
Offline Offline

Location: Where the RV is parked <> Elkton Oregon <> iWD on iMac
Station Type: WMR-100
Posts: 8,381
Local Time: Thursday 13:33



WWW
« Reply #50 on: August 15, 2008, 09:54:24 PM »

I'm a little embarrased as it seems everyone else is not having issues.  Embarassed

Don't be embarrased, I had some problems here as well...ask questions and we will try to help find the problem...
Logged

mth
Rain Maker
***
Offline Offline

Location: Baltimore, Maryland
Station Type: Davis Vantage Pro 2 - Model 6153
Posts: 1,258
Local Time: Thursday 14:33



WWW
« Reply #51 on: August 15, 2008, 11:41:10 PM »

Mike,

That worked!  All is testing and is working.....I appreciate the assistance.  Thanks for sharing and keep the great scripts coming.

Michael
Logged

Michael Holden
Relay, Maryland Weather Station
http://www.relayweather.com

MCHALLIS
Rain Maker
***
Offline Offline

Location: Long Beach, WA USA
Station Type: Davis VP2+
Posts: 1,997
Local Time: Thursday 11:33



WWW
« Reply #52 on: August 15, 2008, 11:56:37 PM »

Version: 1.10 - 14-Aug-2008
small fix in function ctf_validate_email
This update is not needed unless you were getting this error on send:
Fatal error: Call to undefined function getmxrr()
Logged

drobbins
Rain Maker
***
Offline Offline

Location: Kentucky, USA
Station Type: Davis Vantage PRO2
Posts: 1,213
Local Time: Thursday 11:33



WWW
« Reply #53 on: August 16, 2008, 01:46:20 AM »

I got my first "contact" today!! hello1 Just someone saying "Hi".
Logged

chashock
Newbie

Offline Offline

Posts: 2
Local Time: Thursday 17:33


« Reply #54 on: August 16, 2008, 05:02:37 AM »

This script is great.  I appreciate the work you've put into it.

The only question I've got is whether it is feasible to have the same form used for a domain that also has aliases, without turning off domain checking?

I have a domain xyz.com that I have aliased via Apache to also reply to abc.com.  With the way the php is currently set up, I don't see how to allow both domains to post a message, since I can only enter a single domain into the $domain variable.  Since I've used the ServerAlias Directive in Apache, and used all relative linking on the sites, when a user comes in via abc.com, there is no redirect to xyz.com, all references are from abc.com for the duration of their visit.  Therefore, if I have xyz.com listed in the script, and they come in on abc.com, they get the "Input Forbidden" error.

The obvious immediate workaround is to disable $domain_protect, but I'm wondering if an array could be used here without a large re-write of code.  I'm no PHP programmer, but thought this might be an easy way to alleviate the problem.

Your thoughts?
Logged
MCHALLIS
Rain Maker
***
Offline Offline

Location: Long Beach, WA USA
Station Type: Davis VP2+
Posts: 1,997
Local Time: Thursday 11:33



WWW
« Reply #55 on: August 16, 2008, 03:26:52 PM »

This script is great.  I appreciate the work you've put into it.

The only question I've got is whether it is feasible to have the same form used for a domain that also has aliases, without turning off domain checking?

....
Your thoughts?

Here is a solution:
change your $domain config to an array with the domains you want..
// Site Domain without the http://www like this: $domain = 'carmosaic.com';
// can be a single domain:      $domain = 'carmosaic.com';
// can be an array of domains:  $domain = array('carmosaic.com','someothersite.com');
$domain = array('abc.com','xyz.com');

Change this part of the function ctf_spamcheckpost
Change:
Code:

 // Host names from where the form is authorized
 // to be posted from:
 $dom = $domain;
 $authHosts = array("$dom");

To:
Code:
// Host names from where the form is authorized
 // to be posted from:
 if (is_array($domain)) {
    $domain = array_map(strtolower, $domain);
    $authHosts = $domain;
 } else {
    $domain =  strtolower($domain);
    $authHosts = array("$domain");
 }

also change:
$msg =  "Sent from $sitename contact form at $domain

to:
$msg =  "Sent from $sitename contact form

I added to Version: 1.11 - 16-Aug-2008
This update is not needed unless you need this feature

« Last Edit: August 16, 2008, 05:07:35 PM by MCHALLIS » Logged

MCHALLIS
Rain Maker
***
Offline Offline

Location: Long Beach, WA USA
Station Type: Davis VP2+
Posts: 1,997
Local Time: Thursday 11:33



WWW
« Reply #56 on: August 16, 2008, 05:06:25 PM »


Version: 1.11 - 16-Aug-2008
added feature to have the same form used for a domain that also has aliases, without turning off domain checking
http://www.weather-watch.com/smf/index.php/topic,33604.msg274348.html#msg274348
This update is not needed unless you need this feature
Logged

chashock
Newbie

Offline Offline

Posts: 2
Local Time: Thursday 17:33


« Reply #57 on: August 18, 2008, 06:39:36 PM »

Outstanding.  Thank you so much.  I was missing the piece on how to check against the array.  Worked like a charm!
Logged
reif
Junior Forecaster
****
Offline Offline

Location: Denver, Colorado USA
Station Type: Davis Vantage Pro Wireless
Posts: 55
Local Time: Thursday 23:33


WWW
« Reply #58 on: August 20, 2008, 05:51:38 PM »

Mike,

How would one go about adding check boxes to the script?

Thanks very much,
Reif Heck
Logged
nyunyu
Junior Watcher
*
Offline Offline

Posts: 8
Local Time: Thursday 17:33


« Reply #59 on: August 20, 2008, 06:24:29 PM »

Hello, i was looking for a contact form script with captcha and lands on this page.
However, I can't seems to download the secure cpatcha file. Anyone got working link?
Logged
Pages: 1 2 3 [4] 5 6 ... 14
  Print  |  « previous  |  next »  |  Go Up  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!