detecting ssl

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

 



Hi there,

I am trying to detect ssl with the SERVER variable from PHP. Backgrond is that a user might be on an ssl page and the next navigation link he clicks might simply be a non ssl site, but due to relative links there is no way to create a non ssl url for that.

My trie was to check the communication port and if the site should not be ssl, tut the url is a https one, a redirect via php should take place.

Here is the code:
if ($_SERVER[SERVER_PORT] == '443' AND !$SSL){
	header("Location:http://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI]);
	exit;
}

It worked for me, for thousands of others, but not for everybody. Some people just could not use the site anymore. So I guess the SERVER_PORT var can not necessarily be count on.

Has anybody an idea how to overcome this?

Thanx for any hint,

Merlin

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