Forum Moderators: coopster

Message Too Old, No Replies

Transform JS to PHP

Email address protecting

         

henry0

1:04 pm on May 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello
Will it be possible to transform that neat JS in a php code
where VAR LHS and VAR RHS will be $lhs and $rhs
of course on the top adding an include db_connect.php

A site is displaying about 1500 member's email addresses through a directory, those addresses are already published in a printed book version.
However I wish not to facilitate spambot work :)

Thank you

Regards

<<<
<SCRIPT LANGUAGE="JavaScript">
<!--

var lhs = "mike";
var rhs = "website.com";

function print_mail_to_link()
{
document.write("<A HREF=\"mailto");
document.write(":" + lhs + "@");
document.write(rhs + "\">" + lhs + "@" + rhs + "<\/a>");
}

//-->
</SCRIPT>

Here's the code to call the function:

This code goes where you want your “mailto” address to appear on the page.

<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
print_mail_to_link()
</SCRIPT>
>>>

willybfriendly

1:47 pm on May 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could write a similar function in PHP. but being server side the email addresses will be output as regualr HTML.

Why not just include your JS on your pages. That is an easy way to have the benefits of both. Either use the JS in your templates, or echo it from your scripts.

WBF

henry0

11:47 am on May 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you
I will echo it from scripts
HEnry