Welcome Guest, Not a member yet? Register   Sign In
Need is_https()
#1

Hi 
Can you please add isHttps as your system common function.
Code:
if ( ! function_exists('isHttps'))
{
    /**
     * Is HTTPS?
     *
     * Determines if the application is accessed via an encrypted
     * (HTTPS) connection.
     *
     * @return    bool
     */
    function isHttps()
    {
        if ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')
        {
            return TRUE;
        }
        elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https')
        {
            return TRUE;
        }
        elseif ( ! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off')
        {
            return TRUE;
        }

        return FALSE;
    }
}
Reply
#2

(This post was last modified: 09-10-2020, 05:53 AM by MGatner.)

This is already part of the IncomingRequest class, isSecure(). You can access it anywhere like so:

service(‘request’)->isSecure()

https://github.com/codeigniter4/CodeIgni...t.php#L292
Reply
#3

Thanks dear, I just got it.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB