Forum Moderators: coopster

Message Too Old, No Replies

Displaying email addresses

         

kkonline

8:29 am on Sep 5, 2007 (gmt 0)

10+ Year Member



is there any function or class that converts you@example.com into
you [at] yourdomain [dot] com when an actual email is passed to the class/function?

I wrote

<?php

//initialize spam-off function (embed it inna page) - JavaScript
function mailto($address,$text='',$subject=''){
$address="user@example.com";
#divide user from host (cut on @)
$data = explode("@","$address");
#a little extra make-up :)
$hostitj = ereg_replace("\.", ' <u>[dot]</u> ', $data[1]);
#if no text present, display address, just a little formatted ;-)
if ("$text" == "") { $text = $data[0] . ' <u>[at]</u> ' . $hostitj; }
#write link
echo "<a href=\"" . $data[1] . "','" . $data[0] . "'\">" . $text . "</a>";

}
?>

But it gives no error and no display on the screen

[edited by: dreamcatcher at 10:27 am (utc) on Sep. 5, 2007]
[edit reason] Use example.com, thanks. [/edit]

omoutop

8:53 am on Sep 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



$my_var = "name@example.com";

$my_var = str_replace("@", " [at] ", $my_var);
$my_var = str_replace(".", " [dot] ", $my_var);

echo $my_var; // will print: name [at] somedomain [dot] com

i hope this is what you are looking for

[edited by: dreamcatcher at 10:27 am (utc) on Sep. 5, 2007]
[edit reason] Use example.com, thanks. [/edit]