www. check still not working

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

 



<?php

class URL {

	// Public Variables
	public $HTTPS;
	public $ServerName;
	public $WWW;
	
	// Public Functions
	
	public function __construct() {
		$this->checkWWW();
	}
	
	// Check if site is preceeded by 'WWW'
	public function checkWWW() {
		$myDomain = $_SERVER['SERVER_NAME'];
		$FindWWW = 'www.';
		$POS = strpos($myDomain, $FindWWW);
		if ($POS === 1) {
			$this->WWW = true;
		} else {
			$this->WWW = false;
		}
	}

	// Redirect to WWW
	public function WWWRedirect() {
		if ($this->WWW = false) {
$redir = "Location: http://www."; . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
			header($redir);
		}
	}
}

$myURL = new URL();
$myURL->WWWRedirect();

?>

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