SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    563
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Red face How to check URL ?

    Hello,

    I am making a secure site..so i need to check if the page is from the correct url or not..i want to see if page is on https or not. If not https then it should refresh any POST/GET data uisng https.

    How do i do this ?

    Thanks.

  2. #2
    SitePoint Addict
    Join Date
    Jul 2004
    Location
    The Caribbean
    Posts
    267
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, if it is not using SSL and you have recieved POST/GET data, then it's too late; that data was already sent un-encrypted.

    To check for SSL, you can do something like:
    Code:
    if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') {
            header("Location: https://" . $_SERVER['HTTP_HOST']
                                       . $_SERVER['PHP_SELF']);
    }

  3. #3
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    563
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Okay. Thanks i will check it out.

    Thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •