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
LiveFree
Forum Contributor
Posts: 258 Joined: Tue Dec 06, 2005 5:34 pm
Location: W-Town
Post
by LiveFree » Wed Mar 08, 2006 3:21 pm
Hey!
I am developing a phpBB - intergrated Login system for UberHardware .. but what I need to know is if there is a global variable phpBB checks for isset or empty to determine if the user is logged in.
like for example...
Code: Select all
<form method='POST' action='/phpBB/login.php'>
But then how would I access the user details when phpBB loggs him in?
I have seen a few refrences to:
Any and All Help is appriciated!
neophyte
DevNet Resident
Posts: 1537 Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota
Post
by neophyte » Wed Mar 08, 2006 3:36 pm
Set up the system variables some where near the top of the page before headers are sent...
Code: Select all
define('IN_PHPBB', true);
$phpbb_root_path = '/somepath/toyour/root/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.php');
// Start session management
define('PAGE_HOMEPAGE', -12);
$userdata = session_pagestart($user_ip, PAGE_HOMEPAGE);
init_userprefs($userdata);
// End session management
//
The login:
Code: Select all
<?php if(!$userdata['session_logged_in']){ ?>
<h3>Login</h3>
<form action="forum/login.php" method="post" enctype="">
User name:<br />
<input size="12" name="username" /><br />
Password:<br />
<input type="password" size="12" name="password" /><br />
<input type="submit" value="Login" name="login" />
<br />
Not a member? <a href="<?php echo "http://".$board_config['server_name']; ?>/forum/profile.php?mode=register" class="boldblack">Join Today</a> <br />
<a href="http://<?php echo $board_config['server_name']; ?>/forum/profile.php?mode=sendpassword" class="boldblack">Forgot Password?</a>
</form>
<?php } else {
$avatar = get_avatar($userdata['user_avatar_type'], $userdata['user_allowavatar'], $userdata['user_avatar']);
if ($avatar === false){
$avatardisplay = '';
} else {
$avatardisplay = '<p><a href="http://'.$board_config['server_name'].'/forum/index.php">'.$avatar.'</a></p>';
}
echo '
<p>Welcome back:</p>
<h2>'.$userdata['username'].'</h2>
'.$avatardisplay.'
<p>Total Posts: '. $userdata['user_posts'].'<p>
<p> Registered: '. date('d M Y', $userdata['user_regdate']). ' </p>
<p><a href="http://'.$board_config['server_name'].'/forum/index.php">boards</a> | <a href="http://'.$board_config['server_name'].'/forum/login.php?logout=true&sid='.$userdata['session_id'].'">log out</a></p>';
}
?>
That should get you started. The get Avatar function is not native. I built it out of the phpbb code. If it gives you trouble yank it...