PHP/AJAX pop up Mail Form | ||
The pop-up Mail FormThis page presents a simple to implement and fairly secure Javascript/AJAX pop-up mailer. To try it out click the button below.
First we use a script similar to that used in our unblockable pop-up to display a form. At first I thought the form needed a captcha element but then I realised that if we use AJax to get a key value, and wrote the form in javascript this would deter all but the most determined Hackaz.
Below is the Javascript we require in the header: AJAX Pop Up Mailer JavascriptSo we define some functions - the ajax functions are simply called with a flag to govern the actions taken by the script. See AJAX made simple for a description of the script function. We have 2 options here 1=get the magick number and 2=send an email. We then call xmlhttpPost to get the magick number from mcode.php (this is part of our hacker proofing). In addition we need two PHP scripts the magick number script (mcode) and the mailer. Here they are:
AJAX Pop Up Mailer PHP Code for Magick Number (mcode.php)This simple script takes a password and simply echoes a magic number consiisting of the unix timestamp + 8640 converted to base 30 arithmetic. You can do whatever you like to generate a number so long as your system can check it!
AJAX Pop Up Mailer PHP Code for Mail program (mailme.php)So we check first to make sure that the page we are being called from is an allowed page... this avoids cross site script attacks. Then we check the magick number when decoded is between 3 seconds and 20 minutes old. Finally we see if there is actually a message to send, then if all is ok we send the message. In html we need some styling code, a button and two divs, one for the form and one for the response message. Something Like this:
Javascript/AJAX Pop Up Mailer HTML/Javascript CodeNote that the form has also the javascript that puts together the query string data to send to the mail program, and the call to the AJAX functions-this is because I like to group functions with their html where it is logical to do so.
Please note that the exact codes used to secure the mailer on this page have been changed to protect the innocent... Simple Huh? You are welcome to use any or all of this code. A link back would be nice!
Message will go here....
|
Useful Pages
PHP Unique Filename Referrersbookmark hitvidvain.com www.google.co.in www.google.com ... internal hit www.google.com.sg www.google.com.om www.google.co.uk ... ozinengland.com ... ... www.google.com.kh ... ecashhyip.com www.google.co.id ... www.google.com.ph ... www.google.de www.google.at www.google.ro www.google.it www.google.com.tr www.google.com.ar www.google.com.pk www.google.cl www.google.com.au ... ... www.google.com.ng www.google.co.il www.google.lk bilber.net www.google.co.mz www.google.com.br www.google.rs search.babylon.com www.google.be www.google.ee ... www.google.ie yandex.ua blog.bitcomet.com This list of people who link to this PHP Code Snippet page is automagically maintained. Link to us, send traffic, and get listed. Simple. |
|