Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- helper.php
- /**
- * @brief Returns the server protocol
- * @returns the server protocol
- *
- * Returns the server protocol. It respects reverse proxy servers and load balancers
- */
- public static function serverProtocol() {
- if ($_SERVER['HTTP_X_FORWARDED_HOST'] == 'ssl-account.com'){
- $proto = 'https';
- }else{
- if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
- $proto = strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']);
- }else{
- if(isset($_SERVER['HTTPS']) and !empty($_SERVER['HTTPS']) and ($_SERVER['HTTPS']!='off')) {
- $proto = 'https';
- }else{
- $proto = 'http';
- }
- }
- }
- return($proto);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement