Have been working on some PHP code and trying to implement the below code on a forum, and has generally worked okay when a poster is just posting their post only, BUT, when they’re also quoting another users post within theirs, without apparently going against any of the coding below, it gives the error message as if someone has posted one of the below? Is it the [quote] code that appears when quoting someone elses post ?
if (preg_match('/(http|www|.com|.es|.co.uk|.info|.org)/i', request_var('message', '', true)))
What’s that even supposed to do – not a very good check for a URL since if any one of those conditions is true, it works… That is supposed to be a test for a valid URL, right?
I’d probably be checking against parse_url instead of trying to use a regex… since that will give you the individual scheme and host values… or false if it’s malformed.
[QUOTE=Dez;5066331]Have been working on some PHP code and trying to implement the below code on a forum, and has generally worked okay when a poster is just posting their post only, BUT, when they’re also quoting another users post within theirs, without apparently going against any of the coding below, it gives the error message as if someone has posted one of the below? Is it the
code that appears when quoting someone elses post ?
if (preg_match('/(http|www|.com|.es|.co.uk|.info|.org)/i', request_var('message', '', true)))
Put away the crystal ball, it’s not needed. With the .com in the code, it’s also picking up on the words command, competition etc - is there any way that it can just pick up on the .com - (only if it has the dot as the prefix)
Many thanks for the info - much appreciated. Just to clarify, it’s to stop people who haven’t made a certain number of posts, posting a website address, in any form, so for example, if they post just abcdef.com (without any www’s) it would still give an error message.