lolwut
23-10-2007, 09:43 PM
Before you say cleanEmail(); function doesn't exist, it's a custom one.
What it does is when the user types in their email it changes @'s to [at]'s and .'s to [dot]'s. Anyone who's made use of php.net will know what I'm trying to do. The reason for doing this is to stop SPAM bots scanning the memberlist pages to grab people's emails. You may think about using this yourselves.
Note I'm very new to functions and please forgive me if it's a really stupid error.
Here's my code for the function.
<?php
function cleanEmail($var)
{
$find[0] = "/./";
$find[1] = "/@/";
$replace[0] = " [dot] ";
$replace[1] = " [at] ";
ksort($find);
ksort($replace);
preg_replace($find, $replace, $var);
return $var;
}
echo cleanEmail("[email protected]");
?>
And it just echo's out the unclean email which is [email protected] when it should be echo-ing out someone [at] domain [dot] ext. Any help or fixes appreciated.
What it does is when the user types in their email it changes @'s to [at]'s and .'s to [dot]'s. Anyone who's made use of php.net will know what I'm trying to do. The reason for doing this is to stop SPAM bots scanning the memberlist pages to grab people's emails. You may think about using this yourselves.
Note I'm very new to functions and please forgive me if it's a really stupid error.
Here's my code for the function.
<?php
function cleanEmail($var)
{
$find[0] = "/./";
$find[1] = "/@/";
$replace[0] = " [dot] ";
$replace[1] = " [at] ";
ksort($find);
ksort($replace);
preg_replace($find, $replace, $var);
return $var;
}
echo cleanEmail("[email protected]");
?>
And it just echo's out the unclean email which is [email protected] when it should be echo-ing out someone [at] domain [dot] ext. Any help or fixes appreciated.