note 61822 added to function.str-replace
| From: | marko at dise-web dot com | Date: | Mon, 13 Feb 2006 06:38:03 +0000 |
| Subject: | note 61822 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-103599@lists.php.net to get a copy of this message | ||
I elaborated a function in PHP a long time ago to resist to the Spam of email
(parsing) with the function str_replace(), gives back a result similar to PHP.net
Courtesy of http://www.dise-web.com (Marco Antonio Godínez
Bustos).
<?php
function email_replace($correo){
srand((double)microtime()*1000003);
$mode = rand(1,5);
switch ($mode) {
case 1: $at = " at "; $dot = " dot ";
break;
case 2: $at = " {at} "; $dot = " {dot} ";
break;
case 3: $at = "_AT_"; $dot = "_DOT_";
break;
case 4: $at = " [-AT-] "; $punto = " [-DOT-] ";
break;
case 5: $at = "at"; $punto = "dot";
endswitch;
$correo = str_replace("@",$at,$correo);
$correo = str_replace(".",$dot,$correo);
return $correo;
}
# Example:
$email = 'user@example.com';
echo email_replace($email);
# Will return maybe:
#
# 1. user at example dot com
# 2. user {at} example {dot} com
# 3. user_AT_example_DOT_com
# 4. user [-AT-] example [-DOT-] com
# 5. useratexampledotcom
#
?>
----
Server IP: 200.36.127.20
Probable Submitter: 200.52.119.9
----
Manual Page -- http://www.php.net/manual/en/function.str-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61822
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61822&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61822&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61822&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61822&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61822&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61822&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61822&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61822&report=yes
Search -- http://master.php.net/manage/user-notes.php