Re: check if website has www. in front of domain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



    // Check if site is preceeded by 'WWW'
    public function checkWWW() {
        $myDomain = $_SERVER['SERVER_NAME'];
        $FindWWW = 'wwww.';
        $POS = strpos($myDomain, $FindWWW);
        if ($POS === false) {
            return false;
        } else {
            return true;
        }
    }
any idea why this is not working? just trying to test if the site is www.site.com and not site.com
Try this:

Or just change this:

$FindWWW = 'wwww.';

to this:

$FindWWW = 'www.';

Looks like a simple typo. That having been said, however, I think that Richard's solution is more elegant.

thnx,
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux