I’m a new coder here, and this is really beyond my skill set, but I’m trying my best to make this work.
I have a forum I use on my website (phpBB3) which has many members/users registered.
To access some other features of my website, I want to set up a user login. I would like to just have the users login on the website but check their login against the phpBB3 user database.
I have asked for help on the phpBB3 forums, but there really is no support there (and there have been no replies.)
A google search indicates this should be possible and has resulted in the following info link:
On my main directory, I have set up a folder called “login”. I have placed 2 files in it: login-test.php and login-test-index.php
login-test.php
<?php ?>
<form method="post" action="/forum/phpBB3/ucp.php?mode=login">
<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="../../login/login-test-index.php" />
</form>
login-test-index.php
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './forum/';
//$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/phpBB3/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
echo('\user->data[\'user_id\']'.$user->data['user_id'].'<br />');
echo('\user->data[\'username\']'.$user->data['username'].'<br />');
?>
Note: A friend provided the syntax for the echo statements – those are beyond my understanding/comprehension.
When I try using the login-test.php page, it then sends me to my forum’s login page where I received a message saying “The submitted form was invalid. Try submitting again”
When I login from the forum login page that came up, then I do get redirected to login-test-php, however nothing happens as I get a 500 error.
Is the formatting right in those echo statements?
Any help/guidance would be greatly appreciated.
These are also the other reference pages involved:
https://wiki.phpbb.com/User_class
https://wiki.phpbb.com/User.setup
Thank you.
**Edit: I have tried commenting out the echo statements to see if they were causing the “500 error”, but I still get the same error.