Skip to content

Instantly share code, notes, and snippets.

@KaiserWerk
Last active February 6, 2018 15:20
Show Gist options
  • Save KaiserWerk/704a28ef1f1be30f71aff3e7693065cb to your computer and use it in GitHub Desktop.
Save KaiserWerk/704a28ef1f1be30f71aff3e7693065cb to your computer and use it in GitHub Desktop.
A function for checking the current page call happened via SSL or not
<?php
function isSSL() {
if (isset($_SERVER['HTTPS']) ) {
if (!empty($_SERVER['HTTPS'])) {
return true;
}
if (strtolower($_SERVER['HTTPS'] === "on") { // for IIS
return true;
}
} elseif (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) {
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment