|
|
|
|
![]() ![]() |
Dec 11 2007, 09:14 PM
Post
#1
|
|
|
Ephesians 6:10-17 ![]() Group: [MODERATOR] Posts: 1,887 Joined: 22-June 05 From: The World of Gentoo Member No.: 8,528 ![]() |
Description
Concept sparked by the following topic: Email Address Protection From Spam Bots. The idea is to have an image, when clicked on, turn into selectable text. The e-mail is encoded, and that encoding is sent to the server through AJAX to be decoded via PHP. After it is decoded, it gets sent back to be inserted into a text field which is automatically selected upon clicking the image. I have decided to keep things limited to one page for now, where the concept can be easily seen. Code CODE <?php $get = $_GET['code']; if ($get != ""){ echo "mailto: ".base64_decode($get); } else { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>untitled</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <script> function ajaxFunction(id, code){ var xmlHttp; try { // Firefox, Opera, Safari, Konqueror xmlHttp = new XMLHttpRequest(); } catch (e){ // Internet Explorer try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e){ try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange = function(){ if(xmlHttp.readyState == 4){ document.location.href = xmlHttp.responseText; } } xmlHttp.open("GET", "antispam_email.php?code="+code, true); xmlHttp.send(null); } </script> </head> <body> <noscript>In order to select the e-mail you require JavaScript enabled.</noscript> <span id="email_link"><a href="java script: ajaxFunction('email_link', '<?php echo base64_encode("email@domain.com"); ?>');">Click Here To E-mail Me</a></span> </body> </html> <?php } ?> Preview Soon to Come
Got rid of the image, and turned it into a link. Made it possible to load up the e-mail program without leaving the page. This post has been edited by truefusion: Dec 15 2007, 08:18 AM |
|
|
|
Dec 12 2007, 10:20 AM
Post
#2
|
|
|
A clever man learns from his own mistakes, a WISE man learns from those of OTHERS ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 884 Joined: 12-April 06 From: Essex, UK Member No.: 21,719 |
Very nice! I can see many applications here for those who want to use their email address as a point of contact. Dynamic image generation would be a great bonus as that way it could be integrated into websites with many users who need to use their email address as a point of contact, EG profile sites and the like where many email addresses will be saved by this simple idea. Would i be right in assuming this code could be modified to show a MAILTO link instead of the textbox? That culd be even more useful for webmasters who use their email but want to give the user as much ease of use as possible.
Brilliant idea and code there, i can see it helping a lot of people |
|
|
|
Dec 12 2007, 11:56 AM
Post
#3
|
|
|
Ephesians 6:10-17 ![]() Group: [MODERATOR] Posts: 1,887 Joined: 22-June 05 From: The World of Gentoo Member No.: 8,528 ![]() |
Would i be right in assuming this code could be modified to show a MAILTO link instead of the textbox? Yes, it's possible to do that, and i have thought about it, but i figured, why have the user click twice? This post has been edited by truefusion: Dec 15 2007, 08:19 AM |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 7th August 2008 - 11:46 PM |