Best way for implement 'Site Gate' I try to add 'site gate' to http://bartenderlab.it. 
It's alcohol content so people under 18 are not allowed to view this site.

I created module with hook_init:

function gate_init() {

    $curr_uri = request_uri():
    if (strpos($curr_uri, '/gate') === FALSE) {

        if (! isset($_SESSION[GATE_SESSION_NAME])) {

            if (! isset($_COOKIE[GATE_COOKIE_NAME])) {

                    if(strlen($curr_uri) &gt; 1) {

                        drupal_goto('gate', array('destination' =&gt; substr($curr_uri, 1)));

                    }
                    drupal_goto('gate');    

            } else {

                $_SESSION[GATE_SESSION_NAME] = TRUE;

            }
        } 
    } else if(isset($_SESSION[GATE_SESSION_NAME])) {

        drupal_goto('&lt;front&gt;');

    } 
}


Under /gate url is form with:

function gate_form_submit($form_id, &amp;$form_state) {

    $post = $form_state['values'];
    $day = intval($post['gate_day']);
    $month = intval($post['gate_month']); 
    $year = intval($post['gate_year']);
    $isRemember = $post['gate_remember_me'];
    if($day &amp;&amp; $month &amp;&amp; $year) {

        $allowed_age = (int) variable_get('gate_minimal_age', 18);
        $min_born_time = mktime(0, 0, 0, date("m"), date("d"), date("Y") - $allowed_age);
        $born_time = mktime(0, 0, 0, $month, $day, $year);

        if($min_born_time &gt;= $born_time) {

            $_SESSION[GATE_SESSION_NAME] = TRUE;
            if($isRemember) {

                setcookie(GATE_COOKIE_NAME, sha1($born_time + srand()), time() + 60 * 60 * 24 * 7, '/');

            } 
            $dst = '&lt;front&gt;';

            if(isset($_GET['destination'])) {

                $dst = $_GET['destination'];

            }

            drupal_goto($dst);
        }
    } 
}


If checkbox for $isRemember is not checked user should only view site until browser close.

so I set:

ini_set('session.cookie_lifetime',  0);


in settings.php

But after restart browser gate page doesn't appear.

Also after user logout I am redirect to gate page instead of front page.

Please help.
Have a look at Disclaimer module; it seems to be the functionality you're looking for.