forked from leftypol/leftypol
functions net.php: add Tor connections to secure connections
This commit is contained in:
parent
7dcdbc065d
commit
428d9e9001
2 changed files with 11 additions and 4 deletions
|
@ -3,8 +3,15 @@ namespace Vichan\Functions\Net;
|
|||
|
||||
|
||||
/**
|
||||
* @return bool Returns if the client-server connection is an encrypted one (HTTPS).
|
||||
* @return bool Returns if the client-server connection is an HTTPS one.
|
||||
*/
|
||||
function is_connection_secure(): bool {
|
||||
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');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue