[PHP] Sessions not working.

Shadow121

Member
Messages
901
Reaction score
0
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:

Shadow121

Member
Messages
901
Reaction score
0
Points
16
Never mind. I used the wrong function for my sessions. was using ->salt instead of ['salt']
 
Last edited:

Shadow121

Member
Messages
901
Reaction score
0
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
 
Top