You are here: Re: Help with syntax - if domain name exists « PHP Programming Language « IT news, forums, messages
Re: Help with syntax - if domain name exists

Posted by Colin Fine on 10/01/06 19:04

C. wrote:
> affiliateian@gmail.com wrote:
>> I am pretty new to php. Can anyone tell me what the proper syntax is
>> for checking a particular domain from a web form? For instance, I am
>> looking for an if statement that accomplishes this:
>>
>> if ($domain=*.mydomain.com)
>>
>> For some reason, can't get the proper syntax so that sciprt will take.
>
> try:
>
> if (fnmatch("*,mydomain.com", $domain)) {
>
> C.
>
That should read

if (fnmatch("*.mydomain.com", $domain)) {


Note that php.net says:

"For now this function is not available on Windows or other non-POSIX
compliant systems."

so if you're on such a system, you may need a more general solution:

if (preg_match('/\.mydomain.com$/', $domain)) {

which will match any string ending ".mydomain.com".

Colin

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация