Пример #1
0
function use_ssl($turn_on = TRUE)
{
    $url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    if ($turn_on) {
        if (!is_https_on() && $_SERVER['HTTP_HOST'] != 'localhost') {
            redirect('https://' . $url, 'location', 301);
            exit;
        }
    } else {
        if (is_https_on()) {
            redirect('http://' . $url, 'location', 301);
            exit;
        }
    }
}
Пример #2
0
function use_ssl($turn_on = TRUE)
{
    $url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    if ($turn_on) {
        if (!is_https_on() && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') {
            redirect('https://' . $url, 'location', 301);
            exit;
        }
    } else {
        if (is_https_on()) {
            redirect('http://' . $url, 'location', 301);
            exit;
        }
    }
}