prob with the sessions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
forgun
Forum Commoner
Posts: 61
Joined: Wed Jan 29, 2003 6:05 am
Contact:

prob with the sessions

Post 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
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post 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.
User avatar
forgun
Forum Commoner
Posts: 61
Joined: Wed Jan 29, 2003 6:05 am
Contact:

Post by forgun »

but how it's a session variables not a normal one
can u show me how to do that good
bionicdonkey
Forum Contributor
Posts: 132
Joined: Fri Jan 31, 2003 2:28 am
Location: Sydney, Australia
Contact:

Post by bionicdonkey »

$_SESSION['exp'] != true && $_SESSION['login'] == ''
Post Reply