1function is_ssl(){
2 return isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 1 || strtolower($_SERVER['HTTPS'])=='on')
3 || isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT']==443
4 || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO']=='https'
5 || isset($_SERVER['HTTP_X_CLIENT_PROTO']) && $_SERVER['HTTP_X_CLIENT_PROTO']=='https';
6}