mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-03-02 16:33:49 +01:00
19 lines
436 B
PHP
19 lines
436 B
PHP
<?php
|
|
namespace Vichan\Functions\Net;
|
|
|
|
|
|
/**
|
|
* @return bool Returns if the client-server connection is an encrypted one (HTTPS).
|
|
*/
|
|
function is_connection_secure(): bool {
|
|
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
|
|
return true;
|
|
}
|
|
elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
|
|
return true;
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
}
|