View previous topic :: View next topic |
Author |
Message |
Cyberian75
Joined: 26 Sep 2002 Posts: 1274 Location: Oregon
|
Posted: Tue Dec 21, 2004 6:42 pm Post subject: |
|
|
Use this instead... Code: | [^http:\/\/]?[a-z0-9]*\.?[a-z0-9\-]+\.[a-z]{2,6} |
_________________ Michael P.
 |
|
Back to top |
|
 |
ReiXou
Joined: 06 Aug 2003 Posts: 10
|
Posted: Wed Dec 22, 2004 8:58 am Post subject: |
|
|
Cyberian75 wrote: | Actually, "http://www.google.com" should come out as ".google.com" which is used to compared with the URLs in the database. I just did my own testing, and it passed. In your case, you may have a term "google" in your database. |
No I have not. And the same happens with every adress starting with "www." !
I must have a problem somewhere. Or maybe a different version of php. _________________ Olivier |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1274 Location: Oregon
|
Posted: Thu Dec 30, 2004 2:53 am Post subject: |
|
|
Could someone please provide me with a pattern that can take (or match) only the domain name portion of an URL??? For example, from "http://www.example.com," it should be able to take only ".example."
I will credit you accordingly. Thanks.  _________________ Michael P.
 |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 325
|
Posted: Thu Dec 30, 2004 12:40 pm Post subject: |
|
|
Regular expressions can be somewhat of a pain so why don't you use something like the following, which is simple to use if turned into a function
Code: | $host=str_replace("http://","",$host);
$array=explode(".",$host);
if (substr($array[0],0,3)=="www"){
$answer=$array[1];
} else {
$answer=$array[0];
}
echo $answer; |
Ths will give you example (easy to add in . if you want) for
Code: | $host="http://www.example.com"
$host="www.example.com"
$host="http://www2.example.com"
$host="http://example.com" | etc |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1274 Location: Oregon
|
Posted: Thu Dec 30, 2004 6:45 pm Post subject: |
|
|
Thanks for the idea.  _________________ Michael P.
 |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1274 Location: Oregon
|
Posted: Thu Dec 30, 2004 8:45 pm Post subject: |
|
|
Code: | //CHANGELOG
//
//0.8.0: Implemented a smarter URL matching (step 4).
// |
_________________ Michael P.
 |
|
Back to top |
|
 |
ReiXou
Joined: 06 Aug 2003 Posts: 10
|
Posted: Thu Jan 06, 2005 9:41 am Post subject: |
|
|
Your modification is working fine, thank you.
But now I have another pb (gasp !) :
for EVERY comment that I want to add to the balcklist, I have the same message :
Quote: | Deleting...
Comment ID #13430 (insert error: Duplicate entry '127' for key 1) |
Do you know where this comes from ? _________________ Olivier |
|
Back to top |
|
 |
turtelina
Joined: 25 Jan 2002 Posts: 45 Location: Austria
|
Posted: Thu Jan 06, 2005 3:19 pm Post subject: |
|
|
EDIT:
See this is what happens when you dont check the thread regularly like I did. Michael posted a bugfix for it on page 7. |
|
Back to top |
|
 |
ReiXou
Joined: 06 Aug 2003 Posts: 10
|
Posted: Thu Jan 06, 2005 3:45 pm Post subject: |
|
|
turtelina wrote: | EDIT:
See this is what happens when you dont check the thread regularly like I did. Michael posted a bugfix for it on page 7. |
Thanks a lot I try it immediatly (and yes, I missed that message).
EDIT (OK it works I was limited to only 127 IPs, that is, mmmh) _________________ Olivier |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1274 Location: Oregon
|
Posted: Thu Jan 06, 2005 7:03 pm Post subject: |
|
|
_________________ Michael P.
 |
|
Back to top |
|
 |
|