Forum Moderators: coopster

Message Too Old, No Replies

PHP Code to Change Display Based on Refer

         

EliteWeb

11:58 pm on Nov 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just setup a SSL key for one of my domain names. However I have some images that are not on https:// so it brings up warning errors. Id like to be able to use some php code to see if its requesting https:// and if so display something else in its place.

Can this type of thing be done with https:// or is it just file type or domain specific?

dmorison

7:52 am on Nov 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you're using Apache/modssl there are a bunch of SSL related variables pre-defined in $_SERVER for you.


if(isset($_SERVER["HTTPS"]))
{
// we're secure
}

If this doesn't work, create a phpinfo() test page on your secure server and study the global variables for anything that might indicate a secure connection. There is also $_SERVER["SERVER_PORT"] which should hold 443 if you're on a secure page.