Page 1 of 1
problem in fetching user id from phpbb2 session.
Posted: Thu Oct 20, 2005 12:22 am
by itsmani1
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.
Posted: Thu Oct 20, 2005 12:30 am
by feyd
where in the code are you adding this new code? I ask because $userdata, last I saw, had the information for you..
Posted: Thu Oct 20, 2005 12:43 am
by itsmani1
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.
Posted: Thu Oct 20, 2005 12:46 am
by itsmani1
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.
Posted: Thu Oct 20, 2005 12:46 am
by feyd
have you looked at what data is inside the array?

Posted: Thu Oct 20, 2005 12:49 am
by itsmani1
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.
Posted: Thu Oct 20, 2005 2:08 am
by itsmani1
Yeah its done
it can be done by :
$userdata['user_id']
Abdul Mannan.