Page 1 of 1

prob with the sessions

Posted: Mon Apr 07, 2003 2:14 pm
by forgun
i have this code

Code: Select all

<?php
function is_login() {
        if ($_SESSION) {
             if ($exp != true && $login == '') {
                 header("Location: HTTP://" .$_SERVER['HTTP_HOST'] ."/main/admin/index.php?loc=login");
             }
        }
        else { header("Location: HTTP://" .$_SERVER['HTTP_HOST'] ."/main/admin/index.php?loc=login"); }
    }
    function checkuser($user ,$pass) {
        $this->condb();
        if ($this->condb()!=true) {
            foreach ($this->auth as $data) {
                if ($user == $data['user'] && $pass == $data['pass']) {
                    $login = $user;
                    $exp = true;
                    session_register('login');
                    session_register('exp');
                    header("Location: HTTP://" .$_SERVER['HTTP_HOST'] ."/main/admin/index.php?loc=main");
                }
                else {
                    $this->msg = "PassWord/User are not correct"; }
            }
        }
    }

?>
when i active the function is_login the page is not work all the function just hold and don't send the user to any place even if he login and all the data are correct
how i can fix this

Posted: Mon Apr 07, 2003 2:32 pm
by m3mn0n
is_login() has no variables between the parathesis so it won't do anything even though all the code is there. It doesn't have any variables to work the code. Pass the variables required into it just like you did with checkuser().

Hope it works.

Posted: Mon Apr 07, 2003 2:56 pm
by forgun
but how it's a session variables not a normal one
can u show me how to do that good

Posted: Mon Apr 07, 2003 5:12 pm
by bionicdonkey
$_SESSION['exp'] != true && $_SESSION['login'] == ''