Topic: How to know if the administrator is logged in?

I all.
I try to integrate PunBB into my site.
I use external.php to show general information about user and posts.
Now I must know when Administrator is logged or, generally, the user's level (Administrator, simple user and so on).
I try to read $pun_user variable whith this code:

    global $db;
    global $pun_user;
    $lang_common = 'English';
    define('PUN_ROOT', 'pubb/');
    require PUN_ROOT.'include/common.php';
    print_r($pun_user);

and show ALWAYS:

Array ( [id] => 1 [group_id] => 3 [username] => Guest [password] => Guest [email]=> Guest [title] => [realname] => [url]=> [jabber] => [icq] => [msn] => [aim] => [yahoo] => [location] => [use_avatar] => 0 [signature] => [disp_topics] => [disp_posts] => [email_setting] => 1 [save_pass] => 1 [notify_with_post] => 0 [show_smilies] => 1 [show_img] => 1 [show_img_sig] => 1 [show_avatars] => 1 [show_sig] => 1 [timezone] => [language] => [style] => [num_posts] => 0 [last_post] => [registered] => 0 [registration_ip] => 0.0.0.0 [last_visit] => 0 [admin_note] => [activate_string] => [activate_key] => [g_id] => 3 [g_title] => Guest [g_user_title] => [g_read_board] => 1 [g_post_replies] => 0 [g_post_topics] => 0 [g_post_polls] => 0 [g_edit_posts] => 0 [g_delete_posts] => 0 [g_delete_topics] => 0 [g_set_title] => 0 [g_search] => 1 [g_search_users] => 1 [g_edit_subjects_interval] => 0 [g_post_flood] => 0 [g_search_flood] => 0 [logged] => 1116516066 [is_guest] => 1 )


After login or logout say that I'm always "Guest". How it's possible? Where is my mistake?
Any suggestion?

sorry for my english... tongue

Re: How to know if the administrator is logged in?

Check group_id. You can check it against e.g:

PUN_GUEST
PUN_MEMBER
PUN_MOD
PUN_ADMIN

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: How to know if the administrator is logged in?

This is the problem!!!
Unfortunately [group_id] value is always the same!!! I log in, log out, log in as user, log in as administrator and... nothing! [group_id] value doesn't change... is always equal to '3'! sad

Re: How to know if the administrator is logged in?

That means you're not logged in. The reason for this is probably related to the cookie. Are the forums and the website running on different domains/subdomains?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: How to know if the administrator is logged in?

No, forums and the website running on the same domains...
uhm... I try to integrate punBB forum into my portal (entirely writen in PHP) as module. Now I put punBB into a frame:

<iframe width="100%" id="the_iframe" 
    onLoad="calcHeight();" 
    src="moduli/punbb/index.php" 
    scrolling="NO" 
    frameborder="0" 
    height="0">
An iframe capable browser is required to view this web site.
</iframe>

and I login with:

<form id="login" method="post" action="moduli/punbb/login.php?action=in">
    <input type="hidden" name="form_sent" value="1" />                    
    <input type="hidden" name="redirect_url" value="http://www.maxetere.it/index.php?mod=punbb" />    
    Utente
    <br>
    <input type="text" name="req_username" maxlength="25"  class="TestoLogin" />
    <br>
    Password
    <br>
    <input type="password" name="req_password" maxlength="16" class="TestoLogin"   />
    <br><br>
    <input type="submit" name="login" value="Login" />
        <br><br>        
    <a href="moduli/punbb/register.php">Registrati! E' gratis!</a>        
        <br>
    <a href="moduli/punbb/login.php?action=forget">Password persa?</a><br>
</form>

There is a better way to integrate login? And how I can integrate PunBB into my own portal similar to PhpBB with PhpNuke???

Thank you