php - How to find out if you're using HTTPS without $_SERVER['HTTPS'] -


I have seen several tutorials online that say you must have $ _ server ['HTTPS'] If the server connection is secured with HTTPS. My problem is that on some of the servers I have used, $ _ SERVER ['HTTPS'] is an undefined variable that results in an error. Can I see another variable that it should always be defined?

Just to be clear, I am currently using this code if it is a HTTPS connection:

  if (isset ($ _ SERVER ['HTTPS '])) {If ($ _SERVER [' HTTPS '] == "to") {$ secure_connection = true; According to the PHP} documentation: "set for a non-empty value"}  

If the script was inquired through the HTTPS protocol. "Therefore, if you have a false statement in many cases where HTTPS is actually, you would like to verify that $ _ SERVER ['HTTPS'] is present and that is not empty in those cases where HTTPS is not set correctly for a given server, you can check if $ _ SERVER ['SERVER_PORT'] == 443 .

but note That some servers also

HTML>

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -