note 69520 added to function.eregi-replace
| From: | private at sfiac dot net | Date: | Fri, 08 Sep 2006 15:44:55 +0000 |
| Subject: | note 69520 added to function.eregi-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116933@lists.php.net to get a copy of this message | ||
# I was looking to remove all email address and links from post
# for a non-commercial posting website (like forum or classifieds)
# The function
<?PHP
function verify_email_and_link_in_post($c){
# modify email addess and link with this:
$l="LINKS ARE PROHIBITED ON THIS WEBSITE";
$e="EMAIL ADDRESS ARE PROHIBITER ON THIS WEBSITE";
# check for email address
$c=ereg_replace".
"("[-a-z0-9!#$%&\'*+/=?^_`{|}~]+@([.]?[a-zA-Z0-9_/-])*",".
"$e,$c);
# replace all sign @ with the letters at
$c=ereg_replace".
"("@", " at ",$c);
# check for link HTML input
$c=eregi_replace".
"('(<a [^<]*href=["|\']?([^
"\']*)["|\']?[^>].*>([^<]*)</a>)',".
"$l,$c);
# check for anythink like http:// or ftp://
$c=ereg_replace".
"("[a-zA-Z]+://([.]?[a-zA-Z0-9_/-])*",".
"$l,$c);
# check for anyhting starting with www.
$c=ereg_replace".
"("(^| )(www([-]*[.]?[a-zA-Z0-9_/-?&%])*)",".
"$l,$c);
# finaly check for anything like a-z.a-z
$c=ereg_replace".
"("[-a-z0-9!#$%&\'*+/=?^_`{|}~]+[.]+[-a-z0-9]",".
"$l,$c);
return $c;
}
?>
# hope this help someone ;-)
----
Server IP: 194.153.94.10
Probable Submitter: 83.228.190.244
----
Manual Page -- http://www.php.net/manual/en/function.eregi-replace.php
Edit -- https://master.php.net/note/edit/69520
Del: integrated -- https://master.php.net/note/delete/69520/integrated
Del: useless -- https://master.php.net/note/delete/69520/useless
Del: bad code -- https://master.php.net/note/delete/69520/bad+code
Del: spam -- https://master.php.net/note/delete/69520/spam
Del: non-english -- https://master.php.net/note/delete/69520/non-english
Del: in docs -- https://master.php.net/note/delete/69520/in+docs
Del: other reasons-- https://master.php.net/note/delete/69520
Reject -- https://master.php.net/note/reject/69520
Search -- https://master.php.net/manage/user-notes.php