Files
huntingclubroster/classes/Transport.php
T

9 lines
493 B
PHP
Raw Normal View History

<?php
final class Transport {
public static function https(array $server,string $trustedProxies=''): bool {
if(in_array(strtolower((string)($server['HTTPS']??'')),['on','1','https'],true))return true;
$trusted=array_filter(array_map('trim',explode(',',$trustedProxies)),static fn($ip)=>filter_var($ip,FILTER_VALIDATE_IP)!==false);
return in_array($server['REMOTE_ADDR']??'',$trusted,true)&&strtolower(trim($server['HTTP_X_FORWARDED_PROTO']??''))==='https';
}
}