Re: https forced redirect question

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

 



Robert Cummings wrote:
On Fri, 2008-02-15 at 15:05 -0500, Robert Cummings wrote:
On Fri, 2008-02-15 at 14:58 -0500, nihilism machine wrote:
why isnt this redirecting my page to https://www.mydomain.com instead the page stays at my domain.com
<?php

class URL {

	// Public Variables
	public $HTTPS;
	public $ServerName;
	public $WWW;
	
	// Public Functions
	
	public function __construct() {
		$this->checkHTTPS();
		$this->checkWWW();
		$this->ServerName = $_SERVER['SERVER_NAME'];
	}
	
	// Check if HTTPS
	public function checkHTTPS() {
		if ($_SERVER['HTTPS'] != "on") {
			$this->HTTPS = false;
		} else {
			$this->HTTPS = true;
		}
	}
	
	// Redirect to HTTPS Site
	public function HTTPSRedirect() {
		if($this->HTTPS = false) {

Because you're assigning false. Some people switch the order of the
operands so that a typoe like this generates an order. Personally, I
                                                  ^^^^^
Should be "error".

For some reason my finger to brain connection has been experiencing an
inordinate number of erroneous packets today.

Cheers,
Rob.

You should possibly try a reboot. I have found that this helps, once in a while.

But also, in this case the OP could opt-out of assigning anything and just use this instead.

if ( $this->HTTPS ) {
	...
}

He is already assigning a value either way it gets called

Jim Lucas

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