How To Detect If Url Is Secured Ssl With Php In Https
Posted On Fri Jan 02, 2009 By wallpaperama In Tutorial And Guides Forums And Topics Discussions For Help Forums
$_SERVER['HTTPS']
if you want to know if you are using a secured url using port 443 within your site, you can use $_SERVER['HTTPS'], if you are using it will display on
echo $_SERVER['HTTPS'];
this way you can check if your page is using https or http
hope that helps
here is an example of how you can use it
<?php
if($_SERVER['HTTPS']){
echo 'you are secured';
}else{
echo 'you are not secured';
}
?>
try it
web31337 Wed Apr 14, 2010
FIX:
code is
fastcgi_param HTTPS $ssl_protocol;
for some reason "param" was truncated... maybe my fault.
code is
fastcgi_param HTTPS $ssl_protocol;
for some reason "param" was truncated... maybe my fault.
web31337 Wed Apr 14, 2010
This is not working by default in nginx php(fastcgi) and that code will issue notice if in max error_reporting mode.
If you want to check if it is SSL-connected you may wish to add the following line to your fastcgi params list:
[code]fastcgi_pa HTTPS $ssl_protocol;[/code]
$ssl_cipher variable instead of $ssl_protocol.
HTH.
If you want to check if it is SSL-connected you may wish to add the following line to your fastcgi params list:
[code]fastcgi_pa HTTPS $ssl_protocol;[/code]
$ssl_cipher variable instead of $ssl_protocol.
HTH.
Nate Tue Sep 08, 2009
it’s not safe to do it this way. some web servers will set $_server['https'] to 'off' when ssl is not being used. it’s better to test for $_server['https'] == 'on'.
Jeff Sat Aug 15, 2009
you can make an assumption based on your own uploads about the port number however, assuming you use the standard port 443 as your ssl port, you can check to see if $_server["server_port"] does in fact equal 443 -- which is most likely being used for ssl so it is a good backup choice
Jeff Sat Aug 15, 2009
not every apache and mod-ssl server uses this server variable, one of the ones i have access to does not have any ssl variables so detecting it is impossible on that one
Related Content
Information
Forums »
Tutorial And Guides Forums And Topics Discussions For Help »
How To Detect If Url Is Secured Ssl With Php In Https
Tutorial And Guides Forums And Topics Discussions For Help »
How To Detect If Url Is Secured Ssl With Php In Https
Title: How To Detect If Url Is Secured Ssl With Php In Https
Description: How To Detect If Url Is Secured Ssl With Php In Https
Tags: how ,to ,detect ,if ,url ,is ,secured ,ssl ,with ,php ,in ,https
Info: This Post Has Been Viewed 0 Times Since
Date: Fri Jan 02, 2009
Author wallpaperama Received 5 Replies #1481
Date: Fri Jan 02, 2009
Author wallpaperama Received 5 Replies #1481
Share
URL: 

Embed: 

To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it
BBCODE:: 

BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
wallpaperama | Wallpapers | Forums | Terms Of Service
copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5
copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5