Dave Posted August 5, 2008 Posted August 5, 2008 When u user types in Your welcome The code if ((eregi("www.", $_POST['message'])) || (eregi("http://", $_POST['message'])) || (eregi(".com", $_POST['message'])) || (eregi(".co.uk", $_POST['message'])) || (eregi("www.", $_POST['subject'])) || (eregi("http://", $_POST['subject']))) Seems to be set of? Which then executes the code below. Why is this happening? i cannot see anything which could be doing it? Quote
Floydian Posted August 5, 2008 Posted August 5, 2008 Re: Whats going on? I'll preface this by saying that I suck with regex... My guess would be the "com" in welcome is getting caught up by: (eregi(".com", $_POST['message'])) perhaps the "dot" is some sort of control that needs to be escaped? I'm sure Nyna will know for sure what the deal is. I stay away from ereg as much as is humanly possible. However, I wrote a fully comprehensive mail filter that works 100% and in that I did use some ereg, if I recall correctly. But I did it in a far different way. I think I used arrays for matching parameters and whatnot. Perhaps I'll post it somewhere for ya'll ;) Quote
Decepti0n Posted August 5, 2008 Posted August 5, 2008 Re: Whats going on? Yeah, the dot is a wildcard for any character, so it'd match "sahfoashdcom" as well. Try changing it to: if (preg_match('~(www\.|http\://|\.com|\.co\.uk)~', $_POST['message']) || preg_match('~(www\.|http\://)~', $_POST['subject'])) But honestly, there's no point trying to stop links in mails, it's pretty futile and people will get around it Quote
Dave Posted August 5, 2008 Author Posted August 5, 2008 Re: Whats going on? Yes i know but i wanted to add it Thanks for the help Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.