Re: Detecting if browser is using a HTTP or HTTPS connection to view the page

From: Date: Tue, 13 Jul 2004 21:03:19 +0000
Subject: Re: Detecting if browser is using a HTTP or HTTPS connection to view the page
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-190393@lists.php.net to get a copy of this message
On Wednesday 14 July 2004 04:57, Jamie wrote: > The code im using to test is: > if ($_SERVER["HTTPS"] == "off") > { > print "We are not using HTTPS"; > } > else > { > print "We are using HTTPS"; > } > > > On my windows machine it works as expected with it displaying the correct > message when using https and http. When i use my linux box it constantly > displays "We are using HTTPS" what means the statement is evaluating as > false. When it should be true (as im currently viewing the page off a HTTP > connection) You want to specifically check for $_SERVER["HTTPS"] == "on" because if you're not using HTTPS then $_SERVER["HTTPS"] does not exist. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* "If the code and the comments disagree, then both are probably wrong." -- Norm Schryer */

« previous php.general (#190393) next »