HTTPS login only from frontside

Re: [ht1080z] HTTPS login only from frontside

Hi Karls,

The best way to force a user to log-in securely is to place the following PHP code at the top of your log-in page, or any page you want the user to be able to only visit using https:

if (preg_match('/^http:/i', thisPageUrl())) { redirectBrowserToURL(preg_replace('/^http:/i', 'https:', thisPageUrl())); }
This will force the page to redirect to HTTPS. I would also recommend changing any links to the page from http:// to https://, but this is not essential as the php code above will force the change anyway.

Thanks

Greg
Greg Thomas







PHP Programmer - interactivetools.com

Re: [greg] HTTPS login only from frontside

Thank you Greg, it worked just you said.

Karls