Jump to content
MakeWebGames

Whats going on?


Dave
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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 ;)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...