* Thus wrote Jamie:
> 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)

The problem is that this HTTPS variable is not a standard variable
that has been defined. 

Apache's SSL module will only set *a* value to HTTPS if in https is
being used. The value it sets just so happens to be 'on'

Windows servers (versions unkown) will set 'on' or  'off.

Other servers will use either 'on' or 'ON', with or without
corresponding 'off' or 'OFF'.

So, as just described, your best bet would be:

if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on')
  // https is on.
} else {
  // off.
}


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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

Reply via email to