@Steve:
I don't know why you're giving this user so much grief. Login integrations are an extremely common request and there's more than one way to do it depending on the need.
@Cjk75:
Invoking the password manager directly generally isn't needed if all you're trying to do is log someone in and check the result:That invokes the authentication system, gives it the username and password and checks the result. If it's a success, you can then do whatever is necessary to start the main site session as well.
I don't know why you're giving this user so much grief. Login integrations are an extremely common request and there's more than one way to do it depending on the need.
@Cjk75:
Invoking the password manager directly generally isn't needed if all you're trying to do is log someone in and check the result:
Code:
<?phpdefine('IN_PHPBB', true);$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';$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_registered']){//User is already logged inecho 'Welcome back ' . $user->data['username'];}else{if ($request->is_set_post('login')){$username = request_var('username', '', true);$password = request_var('password', '', true);$autologin = $request->is_set_post('autologin');$result = $auth->login($username, $password, $autologin);if ($result['status'] == LOGIN_SUCCESS){//User was successfully logged into phpBB// Do custom work here// Redirect them after successful login$redirect = request_var('redirect', "index.php");// append/replace SID$redirect = reapply_sid($redirect);meta_refresh(3, $redirect);trigger_error('You have been successfully logged in');}else{//User's login failedtrigger_error('Login failed');}}else{echo'<form method="post" action="test.php">Username: <input type="text" name="username" /><br />Password: <input type="password" name="password" /><br />Autologin?: <input type="checkbox" name="autologin" /><br /><input type="submit" name="login" value="Login" /></form>';}}
Statistics: Posted by Noxwizard — Sun Jan 26, 2025 11:07 pm