detect http or https in script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ChrisJ

    detect http or https in script

    I need to include some javascript in my pages to display a "trusted"
    logo. I need one script if its an https page and a different one if its
    an http page. All the pages are created dynamically by the oscommerce
    scripts. How can I detect whether the page is to be delivered over http
    or https so I can choose which to display?

    Chris

  • Steve

    #2
    Re: detect http or https in script

    [color=blue]
    > How can I detect whether the page is to be delivered over http
    > or https so I can choose which to display?[/color]

    Test $_SERVER['HTTPS'] == 'on'

    OR

    $_SERVER['SERVER_PORT'] == 443 // usually

    ---
    Steve

    Comment

    • Martin Lucas-Smith

      #3
      Re: detect http or https in script



      On Mon, 20 Jun 2005, ChrisJ wrote:
      [color=blue]
      > I need to include some javascript in my pages to display a "trusted"
      > logo. I need one script if its an https page and a different one if its
      > an http page. All the pages are created dynamically by the oscommerce
      > scripts. How can I detect whether the page is to be delivered over http
      > or https so I can choose which to display?[/color]


      Try parsing the result of $_SERVER['SERVER_PROTOCO L'] for instance.

      This and other very useful server variables are shown if you do

      phpinfo ();


      Martin

      Comment

      Working...