Topic: [SOLVED] Getting username from $_SESSION?
Hello
If I understood how things work, from a different application, once the user has logged on using PunBB's authentication code, the browser received a cookie that matches the session ID that was created for him, and $_SESSION[] contains information put there by PunBB.
I need to read "username" for the current user, but looping through the array returns nothing:
foreach ($_SESSION as $key => $value){
print sprintf("%s = %s<p>\n",$key,$value);
}
Do I really need to include this whole thing just to read session information for a user who has already logged on?
define('FORUM_ROOT', '/var/www/punbb/');
require FORUM_ROOT . 'include/common.php';
$forum_page['redirect_url'] = $post_info['real_link'];
$forum_page['form_action'] = forum_link($forum_url['login']);
$forum_page['hidden_fields'] = array(
'form_sent' => '<input type="hidden" name="form_sent" value="1" />',
'redirect_url' => '<input type="hidden" name="redirect_url" value="'.forum_htmlencode($forum_page['redirect_url']).'" />',
'csrf_token' => '<input type="hidden" name="csrf_token" value="'.generate_form_token($forum_page['form_action']).'" />'
);
Thank you.