Jump to content

Run Script Only if HTTPS://


signature16

Recommended Posts

I'm not entirely sure about this since I haven't done much with secure connections, but I believe when a user goes through a PHP document with a secure connection, a server variable $_SERVER['HTTPS'] exists (I also forget what information the variable contains but for this situation that isn't important). You can do something like this:

 

if ( ! $_SERVER['HTTPS'] )
{
    header( 'Location: https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] );
    exit;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.