Re: https forced redirect question

From: Date: Fri, 15 Feb 2008 21:09:33 +0000
Subject: Re: https forced redirect question
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-269390@lists.php.net to get a copy of this message
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

« previous php.general (#269390) next »