cloudy

Author Topic: Free Contact Form PHP Script with image captcha - OLD VERSION  (Read 40549 times)

0 Members and 1 Guest are viewing this topic.

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #75 on: August 21, 2008, 06:30:57 PM »
It use a templating system. I don't know if I should put the contact.php code on the index.

Is there a support forum or somebody who supports your template system? You might ask them. I am not familiar with the template system.

Offline TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Global Moderator
  • Posts: 5,859
  • Gremlins are at work...
  • Mesa, AZ
    • TNET Weather Station - Mesa AZ
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #76 on: August 21, 2008, 06:34:17 PM »
I don't know anyone here that is using php templating.  It is common in applications like the SMF forum software etc.. it is a different way of doing thing.

This is more of a PHP scripting issue.  You will need to find people that use that type of scripting for assistance.

All you need is Time, Aptitude and Desire ... and you can build just about anything...

Offline ALITTLEweird1

  • Mark
  • Posts: 3,867
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #77 on: August 26, 2008, 12:31:14 AM »
Very nice script Mike. Easy to install. Can you explain more about this part of the Code for me.

Code: [Select]
// 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 = 0;

I had to shut it off or it wouldnt work. Other than that, Everything works great.
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #78 on: August 26, 2008, 12:51:53 AM »
Very nice script Mike. Easy to install. Can you explain more about this part of the Code for me.

Code: [Select]
// 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 = 0;

I had to shut it off or it wouldnt work. Other than that, Everything works great.

The domain protect feature checks to make sure the form was posted from your form at your domain only. One spammer tactic is to try to post to your form script directly, it tries this because it is a bot, not an actual human typing on your website.

Did you try it this way?

 // 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 = 'snoqualmieweather.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;

Offline ALITTLEweird1

  • Mark
  • Posts: 3,867
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #79 on: August 26, 2008, 01:05:26 AM »
yeah...this is what i have, and it works...If i change it to "1", the message wont send. I can live with it, not a big deal. Was just wondering how that part of the script worked and why not on my host "1and1"

Code: [Select]
// 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 = 'snoqualmieweather.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 = 0;
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #80 on: August 26, 2008, 01:19:19 AM »
yeah...this is what i have, and it works...If i change it to "1", the message wont send. I can live with it, not a big deal. Was just wondering how that part of the script worked and why not on my host "1and1"


That is strange because if the host check fails you will get a Input Forbidden message and the program halts. Do you get that? any error or anything or does it say Message Sent?
Tell me what server it is?
Linux Apache or Windows IIS?


Offline ALITTLEweird1

  • Mark
  • Posts: 3,867
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #81 on: August 26, 2008, 01:21:08 AM »
its Windows Server. and if i do put that "1" in the code, i do get the "Input forbidden" when i hit submit.
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #82 on: August 26, 2008, 01:29:15 AM »
IIS is notorious for having blank server variables ($_SERVER['HTTP_REFERER'])
I will see if I can make a fix(workaround) for that

Offline ALITTLEweird1

  • Mark
  • Posts: 3,867
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #83 on: August 26, 2008, 01:30:57 AM »
OK..Thanks Mike for looking into it.
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #84 on: August 26, 2008, 01:58:48 AM »
Since I do not have IIS, can you test this for me?

Find this:
Code: [Select]

// Where have we been posted from?
 $fromArray = parse_url(strtolower($_SERVER['HTTP_REFERER']));

Replace with this:
Code: [Select]
// Where have we been posted from?
 if( isset($_SERVER['HTTP_REFERER']) and trim($_SERVER['HTTP_REFERER']) != '' ) {
    $fromArray = parse_url(strtolower($_SERVER['HTTP_REFERER']));
 }else if ( isset(env('HTTP_REFERER')) ){
    $fromArray = parse_url(strtolower( env('HTTP_REFERER') ));
 } else if ($domain_protect) {
    return 3; // bail out
 }

Then enable the domain protect and let me know if you can post the form. You do not have to actually send a message, just click submit. see if you get the input forbidden or not.

Offline ALITTLEweird1

  • Mark
  • Posts: 3,867
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #85 on: August 26, 2008, 02:03:04 AM »
When i added that, and uploaded my contact page, i got this when you go to the page..

Code: [Select]
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /homepages/8/d252567151/htdocs/contact.php on line 657
[/code ]


http://www.snoqualmieweather.com/contact.php
« Last Edit: August 26, 2008, 02:07:34 AM by ALITTLEweird1 »
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #86 on: August 26, 2008, 02:07:46 AM »
You might have missed a bracket or something because the code I posted is fine.

Also I was wondering, when it sends you emails was the "Coming from (referer):" part at the bottom of the email blank?

Offline ALITTLEweird1

  • Mark
  • Posts: 3,867
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #87 on: August 26, 2008, 02:11:47 AM »
i copied it again, and got the samething. Before the change you just asked me to do. I had someone test it for me, and it worked fine. heres what it showed in my email....


Coming from (referer): http://www.snoqualmieweather.com/contact.php
Using (user agent): Mozilla/4.0 (compatible; MSIE 7.0; Windows NT
5.1)
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #88 on: August 26, 2008, 02:14:33 AM »
I dunno....
can you put it back the way it was and see if the error goes away.

Offline ALITTLEweird1

  • Mark
  • Posts: 3,867
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #89 on: August 26, 2008, 02:19:09 AM »
I put everything back to normal that works for me.


 $domain_protect = 0;



http://www.snoqualmieweather.com/contact.php
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam