[PHP] Searching a string or similar
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Searching a string or similar
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Searching a string or similar
This should be a better alternative: http://www.php.net/manual/en/function.strip-tags.php -Original Message- From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] Sent: Friday, December 28, 2001 11:14 AM To: Ash Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Searching a string or similar 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]