Topic: Problems Integrating
I have added the includes and I am able to access other functions within common.php, but for some reason I cannot access the $pun_user array.
Here is my code
$punbb_path = './forums/';
define('PUN_ROOT', "$punbb_path");
require PUN_ROOT.'include/common.php';
define('PUN_TURN_OFF_MAINT', 1); // if forums go down the site will not
define('PUN_QUIET_VISIT', 0); // update last visit when outside of the forums
function showloggedin(){
if ($pun_user['id'] > 1){
echo '<p class="loginbox">You are currently logged in as <strong>' . $pun_user['username'] . '.</strong> > <a href="' . $_SERVER['PHP_SELF'] . '?p=logout">Logout</a></p>';
}else{
echo '<p class="loginbox">You are not currently logged in. Please <a href="' . $_SERVER['PHP_SELF'] . '?p=login">login</a> or <a href="' . $_SERVER['PHP_SELF'] . '?p=register">register</a>.</p>';
}
}
I used the $pun_user['id'] to test if the user was logged in, but I am sure there is probably a better way, so that is the second part of my question. I have tried simply echoing the $pun_user['username'] with no luck. I am sure I am logged into the forums.
Any help is much appreciated.