- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsHello,
I have a site which uses jam affiliate script. It has its own login section.
Now I have installed phpbb3 also.
I want that when a user logins from the home page, he should automatically be logged in the forum.
Is there a way to explicitly get a user logged in phpbb
Thanks...
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: markh789Posted on 2009-09-08 at 23:52:11ID: 25288780
Hi,
rum/'; // Needs a trailing Slash!
red']) { SED');
']);
ed']) {
=login">
ed']) ])) ? true : false;
phpEx");
.org/index .php?topic =10222.0 nity/viewt opic.php?f =46&t=6430 75
I am working off a source, though I am re-making it a bit so it works a bit better..
Check the sources at the end as well.
<?php
define('IN_PHPBB', true);
$phpbb_root_path = '/home/user/public_html/fo
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
?>
Thats just the basic bit, I'll get to the login form in a minute, now heres what we need to use to do a bit of checking:
<?php
if(!$user->data['is_registe
if ($user->data['user_id'] != ANONYMOUS) {
trigger_error('NOT_AUTHORI
}
login_box('', $user->lang['NOT_AUTHORISED
}
// Or..
if($user->data['is_register
echo 'Welcome ' . $user->data['username'];
} else {
exit();
}
?>
A bit of HTML for the login form:
<form method="post" action="forum/ucp.php?mode
<label for="username">Username: </label> <input type="text" name="username" id="username" size="40" /><br /><br />
<label for="password">Password: </label><input type="password" name="password" id="password" size="40" /><br /><br />
<label for="autologin">Remember Me?: </label><input type="checkbox" name="autologin" id="autologin" /><br /><br />
<input type="submit" value="Log In" name="login" />
<input type="hidden" name="redirect" value="../index.php" />
</form>
Here is a little script that was called action.php:
<?php
define('IN_PHPBB', true);
$phpbb_root_path = '../forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
if($user->data['is_register
{
echo "Welcome " . $user->data['username']; //User is already logged in
}
else if(isset($_POST['login']))
{
$username = request_var('username', '', true);
$password = request_var('password', '', true);
$autologin = (!empty($_POST['autologin'
$result = $auth->login($username, $password, $autologin);
if ($result['status'] == LOGIN_SUCCESS)
{
//User was successfully logged into phpBB
$redirect = request_var('redirect', "{$phpbb_root_path}index.$
// append/replace SID
$redirect = reapply_sid($redirect);
meta_refresh(0, $redirect);
trigger_error('You have been logged in');
}
else
{
echo 'Bad Login ' . $username; //User's login failed
}
}
else
{
echo '
Please log in:<br />
<form method="POST" action="_SELF">
<p>Username: <input type="text" name="username" size="40"><br />
Password: <input type="password" name="password" size="40"><br />
Remember Me?: <input type="checkbox" name="autologin"><br />
<input type="submit" value="Submit" name="login"></p>
</form>';
}
?>
Sources:
http://forum.websitebaker2
http://www.phpbb.com/commu