Welcome Guest [Log In] [Register]
Search Members Calendar | Rules ZB Code Index IF Code Index
ZBCode
  • Navigation
  • ZBCode
  • Coding Resources
  • Zetaboards Modifications
  • Encrypt Emails
Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ;)

Interested in joining? Click here.


If you are already a member of ZBCode, feel free to login right here:

Username:   Password:
Locked Topic
Encrypt Emails
Tweet Topic Started: Aug 5 2008, 12:34 PM (508 Views)
Viral Aug 5 2008, 12:34 PM Post #1


Posts:
342
Group:
Dedicated
Member
#48
Joined:
Jul 17, 2008
Coding language
PHP
What it does: Webpage to encrypt the email addresses using ROT13, and is only decrypted when a user clicks the email link.
Where it goes: 2 different codes (explained further down)
Browsers: FF3.0 · Opera 9 · IE 7 · IE 8 · Safari 3
Code:

This code goes Below the board / Above Copyright

Code: HTML
 
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
function decipher(str){
var alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM";
var beta = "";
for(var i=0;i<str.length;i++){
if(str.charAt(i)=="@"){beta+="@";}
else if(str.charAt(i)=="."){beta+=".";}
else {beta += alpha.charAt(alpha.indexOf(str.charAt(i))+13);}}
return beta.toLowerCase();}
var anchor = $("a");
for(i=0;i<anchor.length;i++){
if(anchor[i].href.match(/contact\/(.*)/i)){
anchor[i].onclick = function(){location.href="mailto:"+decipher(RegExp.$1.toUpperCase());return false;}}}});
//]]>
</script>


Make a new webpage, title "email", id "email". Paste this into the box:

Code: HTML
 
<div style="float:left;width:48%;text-align:center;"><textarea id="oT" onfocus="this.value=''">Email Address Here</textarea></div><div style="float:right;width:48%;text-align:center;"><textarea id="tT">Encrypted URL Here</textarea></div>

<br /><br /><br /><br /><br /><br />

<div style="text-align:center"><input type="button" id="enc" value="Encrypt"/></div>

<script>
function decipher(str){
var alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM";
var beta = "";
for(var i=0;i<str.length;i++){
if(str.charAt(i)=="@")beta+="@";
else if(str.charAt(i)==".")beta+=".";
else beta += alpha.charAt(alpha.indexOf(str.charAt(i))+13);}
return beta.toLowerCase();}
document.getElementById("oT").value="Email Address Here";
document.getElementById("tT").value="Encrypted URL Here";
document.getElementById("enc").onclick=function(){
document.getElementById("tT").value="http://contact/"+decipher(document.getElementById("oT").value.toUpperCase());}
</script>


What to do: If you or a member wants to post or display an email link, go to the newly created webpage. Type in the email and click encrypt. Copy the encrypted URL, and that's the URL you use for that Email.

Note:

Preview: http://s1.zetaboards.com/viralajax/topic/513965/1/
Edited by Reid, Jun 15 2009, 08:27 PM.

Posted Image
Offline Profile Goto Top
 
Kevin Aug 5 2008, 01:09 PM Post #2
Member Avatar


Posts:
700
Group:
Former Staff
Member
#8
Joined:
Jul 2, 2008
Coding language
HTML/CSS
Very cool code Viral, this can really come in handy I'm sure. :)
Posted Image
Offline Profile Goto Top
 
Viral Aug 5 2008, 02:31 PM Post #3


Posts:
342
Group:
Dedicated
Member
#48
Joined:
Jul 17, 2008
Coding language
PHP
Thanks, I reccomend anyone who has their emails linked on their forum to add this.

Posted Image
Offline Profile Goto Top
 
Webworldx Aug 7 2008, 12:48 AM Post #4


Posts:
36
Group:
Member
Member
#26
Joined:
Jul 14, 2008
Lovely code, great work there :)
ZetaBoards Codes Index - 700+ ZB Codes

InvisionFree Codes Index - 6000+ Codes and Skins
Offline Profile Goto Top
 
Viral Aug 7 2008, 04:38 AM Post #5


Posts:
342
Group:
Dedicated
Member
#48
Joined:
Jul 17, 2008
Coding language
PHP
Thanks James :) .

Posted Image
Offline Profile Goto Top
 
Nor Aug 14 2008, 03:14 PM Post #6


Posts:
13
Group:
Member
Member
#2
Joined:
Jun 8, 2008
Just to let you know, not to be rude, but this code is pointless. Bots do not load javascript, they are simply programs that load all the html like it is, and if there is any css or javascript alterations that you think can make your emails "safe"; false, incorrect. Only way this could be safe is if the email it self was embedded inside the xhtml it self. So a user clicking on the link is useless -.- update it so it at least alerts the email address in a "prompt" box ;) and disable the link from actually making you leave the page
Edited by Nor, Aug 15 2008, 03:39 PM.
Offline Profile Goto Top
 
Reid Aug 14 2008, 06:07 PM Post #7
Member Avatar
What? The land of the free? Whoever told you that was your enemy.

Posts:
1,790
Group:
Distinguished Coder
Member
#148
Joined:
Jul 20, 2008
I'm not entirely sure that all bots don't load JavaScript. I'm sure there are a fair bit of them with the advent of systems using the whole PHP/JS combo to protect their emails, so to speak.
The Resource Board
Offline Profile Goto Top
 
Viral Aug 15 2008, 04:22 AM Post #8


Posts:
342
Group:
Dedicated
Member
#48
Joined:
Jul 17, 2008
Coding language
PHP
Nor... ..bots disable Javascript, which is the reason why this works. All they will see is the encrypted email since it is encrypted beforehand, and not with JS on the page. You need JS enabled for it to automatically decrypt the email link..

Posted Image
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Zetaboards Modifications · Next Topic »
Locked Topic

Track Topic · E-mail Topic Time: 9:36 AM Jul 11
Hosted for free by ZetaBoards · Privacy Policy