List Info

Thread: note 76049 added to function.htmlentities




note 76049 added to function.htmlentities
user name
2007-06-27 14:36:54
This should basically protect the mail addresses on
webpages:

<?php

function InsertMail($mail)
	{
	if ($mail=='') return '';
	$mail = str_replace(array('',':','.'),
array('&#064;','&#058;','&#046;'), $mail);
	$mail = '<a
href=mailto&#058;'.$mail.'>'.$mail.'</a>';
	$len = strlen($mail);
	$i=0;
	while($i<$len)
	    {
	    $c = mt_rand(1,4);
		$par[] = (substr($mail, $i, $c));
		$i += $c;
		}
	$join = implode('"+ "', $par);

	return '<script language=javascript>
	<!--
	document.write("'.$join.'")
	//-->
	</script>';
	}

echo InsertMail ('userexample.com');

?>

Prints a javascript, that joins a bunch of randomly long
substrings (1-4) of hyperlink prefix mailto and email
address, considering that the chars . : and  are
replaced by html entities. It should work just fine.
----
Server IP: 212.24.129.51
Probable Submitter: 85.135.10.2
----
Manual Page -- http://www.php.net/manual/en/function.htmlentities.php

Edit        -- https://master
.php.net/note/edit/76049
Del: integrated  -- h
ttps://master.php.net/note/delete/76049/integrated
Del: useless     -- http
s://master.php.net/note/delete/76049/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/76049/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/76049/spam
Del: non-english -- 
https://master.php.net/note/delete/76049/non-english
Del: in docs     -- http
s://master.php.net/note/delete/76049/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/76049
Reject      -- https://mast
er.php.net/note/reject/76049
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )