SESSION variable placement

Discussion forum for MOD Writers regarding MOD Development.
Locked
grkblood
Registered User
Posts: 5
Joined: Fri Feb 12, 2010 10:11 pm

SESSION variable placement

Post by grkblood »

Im trying to figure out a good place to put two session variables that contain the current user and encrypted password so that i can hotlink the app that i entagrated into my board and the users wont have to relog in. i want to place something like

$_SESSION[username]="whatever i should put here to meet the specified query result"
$_SESSION[password]="whatever i should put here to meet the specified query result"

preferably i think the place place would be inside of a function that is already making a query to phpb1_users but I'm not quite sure.
User avatar
Sam
Former Team Member
Posts: 2082
Joined: Thu Jan 22, 2009 3:59 am
Location: Sacramento, CA
Name: Sam Thompson
Contact:

Re: SESSION variable placement

Post by Sam »

If you integrate phpBB sessions, by including common.php and calling this:

Code: Select all

$user->session_begin();
$auth->acl($user->data);
$user->setup(); 
Now you can access the username by calling $user->data['username'].
Keeping the password in a $_SESSION var is not a particularly good idea, In your other application, it might be easier to integrate phpBB sessions, and force a login from that.
grkblood
Registered User
Posts: 5
Joined: Fri Feb 12, 2010 10:11 pm

Re: SESSION variable placement

Post by grkblood »

so data is a pre declared query result already in phpbb or is it being used as a generic term in your example?
ChaosBringer
Registered User
Posts: 412
Joined: Mon Apr 19, 2004 11:30 pm
Contact:

Re: SESSION variable placement

Post by ChaosBringer »

data is a predetermined array based on a query result in the sessions class.

I use a similar system in my own sessions class.

01000001 01101100 01101100 00100000 01111001 01101111 01110101 01110010 00100000 01100010 01101001 01101110 01100001 01110010 01111001 00100000 01100001 01110010 01100101 00100000 01100010 01100101 01101100 01101111 01101110 01100111 00100000 01110100 01101111 00100000 01110101 01110011 00100001
Locked

Return to “[3.0.x] MOD Writers Discussion”