supa
01-13-2008, 03:59 PM
First I will say that this solution is combined from different free material coding I found on the web.
My work here was only to combine them to work with each other.
So I don't take the credit for the coding (nor responsibility ;) ) .
But it works great and it is very secured way to work with Form to Mail.
As I looked long time to find this kind of solution, and have been helped by many other people I am now glad to share this information with you.
So let’s begin:
1. Download the zip file attached to this thread which contains:
A) Captcha.php
B) SHAMCIL0.TTF
C) Submit.php
D) code 1.txt
E) code 2.txt
*** Pay attention! only the three first files must be upload to your website to the same directory as your Contact form ****
2. Edit the files as follows:
A) captcha.php - This file creates a random "Captcha" picture according to its code setting inside. Each criterion of the image is changeable and you can easily change it inside the code with any editor just look at each line's description to know what it does.
I've already set it to use "SHAMCIL0.TTF" font for example but you can use any font you want Just be sure to upload the font to the same directory as all the other files.
2 more important lines are:
$chars = 'acefgkmvwtyx'; // custom used characters
And..
$numbers = array(1,2,3,4,7); // custom used numbers
These are the characters that will be shown in the Captcha picture.
You can edit them to use lower case letters or upper, use different numbers and etc'.
Pay attention that these letters and numbers have been specifically chosen to be better understood by users.
Many other Captcha's codes use for example the number 0 and the letter o which looks alike and are very confusing , or the number 5 and letter S, so if you do want to change the letters in the picture keep that in mind.
Although you want to prevent spam bots from understanding your Captcha and send you spam, you don't want to get your clients upset by not understanding what the security code is.
It is a fine line, so just choose your preferred way.
B) SHAMCIL0.TTF - this is the font file used to show the security code in the Captcha.
You can upload any font you want, just remember to change the setting in Captcha.php file.
C) submit.php - This is the actual file that will check if the security code entered by the user is correct.
If the security code was wrong the user will see a new window says:
“Incorrect security code, Please try again.
In case the security picture is not clear please refresh the page for a different security picture.”
This comment is editable by entering the file via any editor and look for the text above in the upper part of the file code.
If the security code was correct the submit file will send the mail to your specific mail account and will show the user the following message:
“Information has been submitted to {EnterDomainNameHere}” . (I will soon explain about the EnterDomainNameHere)
And will echo all the information submitted by the user.
* There are only 3 parts you need to change in the Submit.php file code,
And that is your domain name.
After entering the file via any editor make a search for the string:
“EnterDomainNameHere”
You will find there are 3 places with that string.
The first two are for security reasons. It won't allow any Spam bots to use your mail form in order to send garbage to other Emails. Just write down your domain one time with the www. And another without it.
The third string to change is for your Company\Name\Site name, this name will be used when the user will get the success send page.
3. Now that we finished editing the files it is time to edit the contact form itself on Web Easy.
Put any kind of contact form on your page via - Insert -> Object -> Forms tab. We need to add to this form 4 more things to get it going.
Insert a hidden field via Insert -> Object -> Forms tab - tick the "Show all advanced objects"
Look for the "Field: hidden" and insert it. Repeat it 3 times so you have 3 hidden fields Placed on your form. It is important to put it inside the form, just press the form before you insert those fields, and check it by moving your form around... All the fields should be able to move with the form.
Now to edit those hidden field:
A) Pick one and open the Inspector properties (Ctrl+K) in the Custom Script field enter : name="env_report"
In the Html Value enter: REMOTE_ADDR,HTTP_USER_AGENT (this field objective is to add the user's parameters like his IP number to your receiving mail.
B) The second hidden field will be your subject of the mail. In the Inspector properties (Ctrl+K) in the Custom Script field enter: name="subject"
in the Html Value enter: "Whatever you like the subject to be"
C) This is the most important hidden field as this is your recipient Email. This Email will be used by the Submit.php file in order to send you the desired mail.
In this hidden field you only enter the following code at the Inspector properties (Ctrl+K) in the Custom Script field:
(Look into file: "Code 1" to view the required code as i cannot write it here due to Avanquest forum restriction)
This code is another trick to get those Spam Bots away as it doesn't expose your Email address. As you can see this code will build your email address from A+B+C simple Formula.
All you need to do is fill in the "EnterDomain" and "Contact" Fields.
For example: Billing@Gmail.com --- input "Gmail" instead "EnterDomain"
And "Billing" instead of "contact"
D) Now we need to insert another object which is the Captcha image itself and the input security code.
Insert a simple box into the form. Press on it and enter the following code at the Inspector properties (Ctrl+K) in the Custom Script field:
(Look into file: "Code 2" to view the required code as i cannot write it here due to Avanquest forum restriction)
Pay attention that I made that text box style to accept only lowercase letters.
This is again to help users by allowing them not to be confused as to which letter to input lower or upper.
We just force the input to be in lowercase. You can easily change it to upper if you wish or delete it.
One more thing and we are finished i promise...
Press on the form itself and look at the Inspector properties (Ctrl+K) enter the following code at Html Action Field:
../YourDirectory/submit.php
Change “YourDirectory” to the directory on which the Submit.php file is in.
And choose POST at the Html Method.
That’s it!
You have just finished creating your own Captcha Form to Mail!
Now go drink something and kiss the wife
Supa
My work here was only to combine them to work with each other.
So I don't take the credit for the coding (nor responsibility ;) ) .
But it works great and it is very secured way to work with Form to Mail.
As I looked long time to find this kind of solution, and have been helped by many other people I am now glad to share this information with you.
So let’s begin:
1. Download the zip file attached to this thread which contains:
A) Captcha.php
B) SHAMCIL0.TTF
C) Submit.php
D) code 1.txt
E) code 2.txt
*** Pay attention! only the three first files must be upload to your website to the same directory as your Contact form ****
2. Edit the files as follows:
A) captcha.php - This file creates a random "Captcha" picture according to its code setting inside. Each criterion of the image is changeable and you can easily change it inside the code with any editor just look at each line's description to know what it does.
I've already set it to use "SHAMCIL0.TTF" font for example but you can use any font you want Just be sure to upload the font to the same directory as all the other files.
2 more important lines are:
$chars = 'acefgkmvwtyx'; // custom used characters
And..
$numbers = array(1,2,3,4,7); // custom used numbers
These are the characters that will be shown in the Captcha picture.
You can edit them to use lower case letters or upper, use different numbers and etc'.
Pay attention that these letters and numbers have been specifically chosen to be better understood by users.
Many other Captcha's codes use for example the number 0 and the letter o which looks alike and are very confusing , or the number 5 and letter S, so if you do want to change the letters in the picture keep that in mind.
Although you want to prevent spam bots from understanding your Captcha and send you spam, you don't want to get your clients upset by not understanding what the security code is.
It is a fine line, so just choose your preferred way.
B) SHAMCIL0.TTF - this is the font file used to show the security code in the Captcha.
You can upload any font you want, just remember to change the setting in Captcha.php file.
C) submit.php - This is the actual file that will check if the security code entered by the user is correct.
If the security code was wrong the user will see a new window says:
“Incorrect security code, Please try again.
In case the security picture is not clear please refresh the page for a different security picture.”
This comment is editable by entering the file via any editor and look for the text above in the upper part of the file code.
If the security code was correct the submit file will send the mail to your specific mail account and will show the user the following message:
“Information has been submitted to {EnterDomainNameHere}” . (I will soon explain about the EnterDomainNameHere)
And will echo all the information submitted by the user.
* There are only 3 parts you need to change in the Submit.php file code,
And that is your domain name.
After entering the file via any editor make a search for the string:
“EnterDomainNameHere”
You will find there are 3 places with that string.
The first two are for security reasons. It won't allow any Spam bots to use your mail form in order to send garbage to other Emails. Just write down your domain one time with the www. And another without it.
The third string to change is for your Company\Name\Site name, this name will be used when the user will get the success send page.
3. Now that we finished editing the files it is time to edit the contact form itself on Web Easy.
Put any kind of contact form on your page via - Insert -> Object -> Forms tab. We need to add to this form 4 more things to get it going.
Insert a hidden field via Insert -> Object -> Forms tab - tick the "Show all advanced objects"
Look for the "Field: hidden" and insert it. Repeat it 3 times so you have 3 hidden fields Placed on your form. It is important to put it inside the form, just press the form before you insert those fields, and check it by moving your form around... All the fields should be able to move with the form.
Now to edit those hidden field:
A) Pick one and open the Inspector properties (Ctrl+K) in the Custom Script field enter : name="env_report"
In the Html Value enter: REMOTE_ADDR,HTTP_USER_AGENT (this field objective is to add the user's parameters like his IP number to your receiving mail.
B) The second hidden field will be your subject of the mail. In the Inspector properties (Ctrl+K) in the Custom Script field enter: name="subject"
in the Html Value enter: "Whatever you like the subject to be"
C) This is the most important hidden field as this is your recipient Email. This Email will be used by the Submit.php file in order to send you the desired mail.
In this hidden field you only enter the following code at the Inspector properties (Ctrl+K) in the Custom Script field:
(Look into file: "Code 1" to view the required code as i cannot write it here due to Avanquest forum restriction)
This code is another trick to get those Spam Bots away as it doesn't expose your Email address. As you can see this code will build your email address from A+B+C simple Formula.
All you need to do is fill in the "EnterDomain" and "Contact" Fields.
For example: Billing@Gmail.com --- input "Gmail" instead "EnterDomain"
And "Billing" instead of "contact"
D) Now we need to insert another object which is the Captcha image itself and the input security code.
Insert a simple box into the form. Press on it and enter the following code at the Inspector properties (Ctrl+K) in the Custom Script field:
(Look into file: "Code 2" to view the required code as i cannot write it here due to Avanquest forum restriction)
Pay attention that I made that text box style to accept only lowercase letters.
This is again to help users by allowing them not to be confused as to which letter to input lower or upper.
We just force the input to be in lowercase. You can easily change it to upper if you wish or delete it.
One more thing and we are finished i promise...
Press on the form itself and look at the Inspector properties (Ctrl+K) enter the following code at Html Action Field:
../YourDirectory/submit.php
Change “YourDirectory” to the directory on which the Submit.php file is in.
And choose POST at the Html Method.
That’s it!
You have just finished creating your own Captcha Form to Mail!
Now go drink something and kiss the wife
Supa