[PHP] Sessions not working.

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by Shadow121, Dec 24, 2008.

  1. Shadow121

    Shadow121 Member

    Messages:
    901
    Likes Received:
    0
    Trophy Points:
    16
    Alrgiht I've set up my login script which has set teh username and password session yet when I go to /cPanel/ it refuses to show me as logged in. Below is my code.

    login file:
    Code:
    $_SESSION['username'] = $username;
    $_SESSION['password'] = $Functions->Encrypt($password, $arrayUser->salt);
    
    THen in my config file I have
    Code:
    $usrLogin_query = $db->dbQuery("SELECT * FROM `" . DB_PREFIX .
        "users` WHERE `username` = '" . $_SESSION['username'] . "' AND `password` = '" .
        $_SESSION['password'] . "';");
    $usrLogin = $db->dbFetch($usrLogin_query);
    
    At the bottom of the config file I have:
    Code:
    print_r($usrLogin);
    die();
    
    For debug purposes.

    Any help with this?

    When I visit the site it should have all my users information but it shows up blank.

    I also have session_start() at the top of configuration file.
     
    Last edited: Dec 24, 2008
  2. tttony

    tttony Member

    Messages:
    147
    Likes Received:
    0
    Trophy Points:
    16
  3. Shadow121

    Shadow121 Member

    Messages:
    901
    Likes Received:
    0
    Trophy Points:
    16
    Never mind. I used the wrong function for my sessions. was using ->salt instead of ['salt']
     
    Last edited: Dec 25, 2008
  4. tttony

    tttony Member

    Messages:
    147
    Likes Received:
    0
    Trophy Points:
    16
    ah ok, is an object session
     
  5. Shadow121

    Shadow121 Member

    Messages:
    901
    Likes Received:
    0
    Trophy Points:
    16
    Meh. I forgot I switched my DBA class to array instead of object. I changed it, figured Hell I could probably switch it to object in the smarty templates too so I did and its all working fine now ;D
     

Share This Page