Buy Sell Discuss UK Domain Names at AcornDomains.co.uk

Today's Drop Dates are: 07-11-2011 or 14-11-2011   All times are GMT. The time now is 06:05:32 PM.
Domain Name Sales Domain Software Calculate UK Domain Drop Dates Domain Registration NameDrive Domain Parking Subscribe to our Domains For Sale newsletter
Go Back   Domain Forum Acorn Domains Buy Sell Auction UK Domains > Website Design and Promotion > Website Design > Scripts and Coding
Connect with Facebook

Scripts and Coding PHP, MySQL, scripts

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 18-02-2009, 12:24:01 AM     #11 (permalink)

 
Skinner's Avatar
 
Join Date: Jul 2008
Location: Manchester
Posts: 2,501
Skinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond repute

Negative Grant.

It fails.

http://www.24i.co.uk/je.php

Look how many it missed, and how many funky names it allowed thru.
__________________
Browse:
Skinner is offline  
Old 18-02-2009, 09:22:31 AM     #12 (permalink)

 
Join Date: May 2006
Posts: 1,192
Jeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond repute

Quote:
Originally Posted by Skinner View Post
Whizz, we are talking about returning ONLY the domain.ext with no subdomains.
That's not what Purg asked:

Quote:
Originally Posted by Jeewhizz View Post
what bit do you want specifically? Just the 'test' in www.test.co.uk ?
Quote:
Originally Posted by purg View Post
Whizz.... Correct
---

To return the domain name, no matter the subdomain level, try this. It's not 100% perfect, but will cover 99% of all domains:

PHP Code:
<?php

$domains 
= array("www.test.com","www.test2.co.uk","www.test3.info","www.test4.wz","www.test5.museum","http://test6.co.uk","test7.co.uk","http://www.test8.co.uk","really.long.sub.domain.here.test9.org.uk");

foreach(
$domains as $domain) {
    if(
preg_match("/\.?([a-z0-9-]+)(\.(co|org|me|ltd|plc)\.[a-z]{2})$/i",$domain,$m)) {
        
//we've matched a ******.co.** domain
        
$dom $m[1];
        
$dom2 $m[1].$m[2];
        
//print_r($m);
    
} else {
        
//treat the domain as a .com/net/org/ws/biz/info
        
preg_match("/\.?([a-z0-9-]+)(\.[a-z]{2,})$/i",$domain,$m);
        
$dom $m[1];
        
$dom2 $m[1].$m[2];
    }
    echo 
$domain.' ==> '.$dom2.' --> '.$dom.'<br />';
}
?>
Quote:
www.test.com ==> test.com --> test
www.test2.co.uk ==> test2.co.uk --> test2
www.test3.info ==> test3.info --> test3
www.test4.wz ==> test4.wz --> test4
www.test5.museum ==> test5.museum --> test5
http://test6.co.uk ==> test6.co.uk --> test6
test7.co.uk ==> test7.co.uk --> test7
http://www.test8.co.uk ==> test8.co.uk --> test8
really.long.sub.domain.here.test9.org.uk ==> test9.org.uk --> test9
Jeewhizz is offline  
Old 18-02-2009, 11:00:31 AM     #13 (permalink)

 
Skinner's Avatar
 
Join Date: Jul 2008
Location: Manchester
Posts: 2,501
Skinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond repute

My bad,

I was concentrating on

Quote:
Ive also noticed $_SERVER['SERVER_NAME'] sometimes contains WWW. that needs stripping.
Assuming that it was the same sub.dom problem that keeps rearing its ugly head.

that 1% is what pisses me off :P.

I haven't tested this but looking at the regex (and i suck as regex), won't things like ?.uk.com, ?.gb.com and the funky names that likes still cause a fail (altho for the ?.gb/eu/uk/etc.com, an OR op like the co/org/etc could be added. (edited as I missed some of the regex ".[a-z]{2})" coz it went off screen, so that fixes the co.cctld).

Are there any other common ?.ccTLD ? I can only think of gov/plc/ltd/org/co/me/net/ac/edu, but they would be easy to add in to your code anyway. (edited again)

Anyway this is why I gave up and went slasher movie for my needs :P

p.s. sorry for jacking your thread your purg.
__________________
Browse:

Last edited by Skinner; 18-02-2009 at 11:06:36 AM.
Skinner is offline  
Old 18-02-2009, 11:27:23 AM     #14 (permalink)

 
Join Date: Sep 2006
Posts: 407
purg has a reputation beyond reputepurg has a reputation beyond reputepurg has a reputation beyond reputepurg has a reputation beyond reputepurg has a reputation beyond reputepurg has a reputation beyond reputepurg has a reputation beyond reputepurg has a reputation beyond reputepurg has a reputation beyond reputepurg has a reputation beyond reputepurg has a reputation beyond repute

Whizz... looks good for my needs. My site is almost complete for testing so will include your snippet before going live.

Skinner.... No problem, from your posts ive seen more into the problem than first thought. If the snippet posted by Whizz could be expanded to cover your needs everyone's a winner. Its this kind of post this keep me coming back to the AD forum. The AD community highlight flaws but also follow up by creating the fix for everyone to use.

(Also helps AD SEO which bring fresh meat into the mix)
purg is offline  
Old 18-02-2009, 11:29:53 AM     #15 (permalink)

 
Join Date: May 2006
Posts: 1,192
Jeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond repute

Quote:
Originally Posted by Skinner View Post

I haven't tested this but looking at the regex (and i suck as regex), won't things like ?.uk.com, ?.gb.com and the funky names that likes still cause a fail (altho for the ?.gb/eu/uk/etc.com, an OR op like the co/org/etc could be added. (edited as I missed some of the regex ".[a-z]{2})" coz it went off screen, so that fixes the co.cctld).

Are there any other common ?.ccTLD ? I can only think of gov/plc/ltd/org/co/me/net/ac/edu, but they would be easy to add in to your code anyway. (edited again)
It won't catch the .uk.com TLD's etc. It could be extended to do these.

The above is merely just a starting point
Jeewhizz is offline  
Old 18-02-2009, 11:34:03 AM     #16 (permalink)

 
Join Date: May 2006
Posts: 1,192
Jeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond reputeJeewhizz has a reputation beyond repute

I will have a go at the .uk.com SLD's another time.

if anyone uses the above, and wants to make a donation - please do so to Admin
Jeewhizz is offline  
Old 02-03-2010, 04:01:11 PM     #17 (permalink)

 
Join Date: Jan 2007
Location: Barnsley, South Yorkshire
Posts: 515
StudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond repute

Hi Guys,

Keep in mind that eregi will be deprecated as of PHP 5.3.0 and completely removed as of PHP 6

A better solution would be PHP's parse_url function

PHP Code:
$url 'http://username:password@hostname/path?arg=value#anchor';
$parsed_url parse_url($url); // This would return an array

print_r($parsed_url); 
This would output

PHP Code:
Array
(
    [
scheme] => http
    
[host] => hostname
    
[user] => username
    
[pass] => password
    
[path] => /path
    
[query] => arg=value
    
[fragment] => anchor

If you wanted to output any of the values by themselves e.g. hostname

PHP Code:
echo $parsed_url['host']; 
or you can output a single value straight from the function

PHP Code:
echo parse_url($urlPHP_URL_HOST); // This will output hostname 
More info on the parse_url function can be found here

As for the OP's problem, you would then further process the output using something like Jeewhizz's solution above.

Hope this helps!

Craig

Last edited by StudioVision; 02-03-2010 at 04:52:51 PM.
StudioVision is online now  
Closed Thread



Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Domain Name Community Replies Last Post
Bounce.co.uk appeal decision michaeltoth Domain Name Disputes 65 22-07-2006 04:14:14 AM




All times are GMT. The time now is 06:05:32 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.0 RC 2
All content on Acorn Domains is member generated and is not moderated before posting. All content is viewed and used by you at your own risk and AD does not warrant the accuracy or reliability of any of the information. The views expressed are those of the individual contributors and not necessarily those of AD. Please contact us to report any issues or send a PM to "Admin".