Skip to content

Instantly share code, notes, and snippets.

@Kyngo
Created July 24, 2018 08:32
Show Gist options
  • Save Kyngo/3535df749062711a46efe7a5a68b3aa6 to your computer and use it in GitHub Desktop.
Save Kyngo/3535df749062711a46efe7a5a68b3aa6 to your computer and use it in GitHub Desktop.
Deny HTTP connections with PHP
<?php
if ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) {
return true;
} else {
die("Unsafe connections are not allowed!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment