You are here: Re: how to check for "a href=" in a string « PHP Programming Language « IT news, forums, messages
Re: how to check for "a href=" in a string

Posted by Allodoxaphobia on 01/23/07 18:22

On Tue, 23 Jan 2007 17:38:52 +0100, Veco wrote:
> Hi guys! (and girls if any ;)
>
> I want to block my users from submitting a string that includes link(s)
> stated using a href=...
>
> probably there's some function in php?
>
> i don't want eregi_replace, I just want the code to check a string in
> variable if there's any a href... if so, then I'll use exit(); or smthng
> else

A function I wrote to sit in a message board program I wrote:

function check_bad_content($string)
{
// Stuff that spammers post with:
$bad_strings = array('www.','/url]','ttp://','ttps://') ;

foreach( $bad_strings as $bad_string )
{
if ( ereg( $bad_string, $string ) ) return false ;
}

return true;

} // E-O-function check_bad_content

The entire message is passed in the parameter to check_bad_content.

HTH
Jonesy
--
Marvin L Jones | jonz | W3DHJ | linux
38.24N 104.55W | @ config.com | Jonesy | OS/2
*** Killfiling google posts: <http://jonz.net/ng.htm>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация