Skip to content

Instantly share code, notes, and snippets.

@Prid13
Created July 6, 2018 00:43
Show Gist options
  • Save Prid13/74ae9e44f094802919bdcfeedba8d745 to your computer and use it in GitHub Desktop.
Save Prid13/74ae9e44f094802919bdcfeedba8d745 to your computer and use it in GitHub Desktop.
Automated login script for phpBB
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
if($user->data['is_registered'])
{
header('Location: http://website.com/phpBB/');
}
else
{
$username = request_var('username', '', true);
$password = request_var('password', '', true);
$result = $auth->login($username, $password);
if ($result['status'] == LOGIN_SUCCESS)
{
//User was successfully logged into phpBB
//echo "Login Success";
header('Location: http://website.com/phpBB/');
}
else
{
//User's login failed
echo "Login Failed";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment