LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   https or http? (https://www.linuxquestions.org/questions/programming-9/https-or-http-34202/)

antken 10-30-2002 03:59 PM

https or http?
 
hi,


how can i use php to workout if a user is using https ?


basically i want to make certain that my users get redirected from a non secure site to a secure one


any ideas?

leed_25 10-30-2002 04:50 PM

maybe you could try something like this (untested):
Code:

if (preg_match("/^https/i",  $_SERVER['SERVER_PROTOCOL'])) {
  //  your code here
}


antken 10-30-2002 04:58 PM

i take it then looking at that code ' preg_match ' is the equlivilent of grep at the command line?

leed_25 10-30-2002 05:06 PM

'preg' stands for 'perl regular expression'.

dig into this


All times are GMT -5. The time now is 03:34 AM.