Re: most reliable way to test if using https

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

 



On Sat, Jan 14, 2006 at 04:20:27AM +0000, Matt wrote:
> James Benson wrote:
> 
> >What is the most reliable way to test if a connection is already using 
> >the https protocol, is their a PHP constant or something builtin already?
> >
> >
> >
> >Thanks,
> >James
> >
> Something like?
> 
> if (isset($_SERVER["HTTPS"]) && 'on' == $_SERVER["HTTPS"])
> {// ssl
> } else {
> // non-ssl
> }

To be safe about this is to ensure that the var HTTPS is compare in
a caseless manner like:

  'on' == strtolower($_SERVER["HTTPS"])

Most webservers report it in lower case but some say 'On' 

Curt.
-- 
cat .signature: No such file or directory

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