Re: Searching a string or similar
| From: | Bogdan Stancescu | Date: | Fri, 28 Dec 2001 19:14:09 +0000 |
| Subject: | Re: Searching a string or similar | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78963@lists.php.net to get a copy of this message | ||
if (strpos("<SCRIPT LANGUAGE = Javascript>",$input_string)===false) {
echo("Yeah, right!");
exit;
}
You'll have a lot of problems, though, because
1. You also need to check for <script type="text/javascript">;
2. You have to strtolower() both strings in order to eliminate capitalization
differences;
3. and the tougher: how do you check for this one:
"<script language ='javascript' \t>", where
"\t"
is a tab character? And obviously all the possible combinations...
Bogdan
Ash wrote:
> Hi i've taken a look throught he manual and i can't find a function to do
> this
>
> Basically i want to take in a string and check that the string doesn't
> contain a certain word or something
>
> ie check that it doesn't contain <SCRIPT LANGUAGE = Javascript> to prevent
> hackers/crackers on my guestbook
>
> Thanks
>
> Ash
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net