18 lines
490 B
PHP
18 lines
490 B
PHP
<?php
|
|
namespace Vichan\Functions\Net;
|
|
|
|
|
|
/**
|
|
* @return bool Returns if the client-server connection is an HTTPS one.
|
|
*/
|
|
function is_connection_https(): bool {
|
|
return !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off';
|
|
}
|
|
|
|
/**
|
|
* @return bool Returns if the client-server connection is an encrypted one (HTTPS or Tor loopback).
|
|
*/
|
|
function is_connection_secure(): bool {
|
|
return is_connection_https() || (!empty($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] === '127.0.0.1');
|
|
}
|