Skip to content

Instantly share code, notes, and snippets.

@larsmqller
Last active August 29, 2015 14:13
Show Gist options
  • Save larsmqller/d0886ec2e38c45f78cfe to your computer and use it in GitHub Desktop.
Save larsmqller/d0886ec2e38c45f78cfe to your computer and use it in GitHub Desktop.
<?php
/*
Check if protocol is https
Nb: port 443 does not guarantee connection is encrypted
http://stackoverflow.com/questions/1175096/how-to-find-out-if-you-are-using-https-without-serverhttps#answer-2886224
*/
function isSecure() {
return
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|| $_SERVER['SERVER_PORT'] == 443;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment