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
itsmani1
Forum Regular
Posts: 791 Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:
Post
by itsmani1 » Thu Oct 20, 2005 12:22 am
i am using phpbb2 and i want to fetch userid from session can any one help me in this regards. i have successfully checked wheather the user has logged in or not but i don't know which user has logged in?
Help Please.....
Abdul Mannan.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Oct 20, 2005 12:30 am
where in the code are you adding this new code? I ask because $userdata, last I saw, had the information for you..
itsmani1
Forum Regular
Posts: 791 Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:
Post
by itsmani1 » Thu Oct 20, 2005 12:43 am
Code: Select all
session_start();
define('IN_PHPBB', true);
$phpbb_root_path = '../phpBB2/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
if ($userdata['session_logged_in'])
{
echo "User has logged in.....";
}
now what happens when user is logged in it prints the string other wise it don't but i don't know what is the user id who has logged in?
Thanx.
Mannan.
itsmani1
Forum Regular
Posts: 791 Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:
Post
by itsmani1 » Thu Oct 20, 2005 12:46 am
feyd wrote: where in the code are you adding this new code? I ask because $userdata, last I saw, had the information for you..
how can i get info from user data ?
if I try
Code: Select all
if ($userdata['session_logged_in'])
it tells me wheather user has logged in or not? but it don't tell me which user has logged in?
Thanx.
Mannan.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Oct 20, 2005 12:46 am
have you looked at what data is inside the array?
itsmani1
Forum Regular
Posts: 791 Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:
Post
by itsmani1 » Thu Oct 20, 2005 12:49 am
feyd wrote: have you looked at what data is inside the array?
i tried but i did not found. the only thing i got i have told you, if you know plz tell me.
Thanx.
itsmani1
Forum Regular
Posts: 791 Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:
Post
by itsmani1 » Thu Oct 20, 2005 2:08 am
Yeah its done
it can be done by :
$userdata['user_id']
Abdul Mannan.