phpBB API – Auto Login a User Without a Password
<?php
define(‘IN_PHPBB’, true);//Must be defined
$phpbb_root_path = ‘../phpBB3/’;//your forum directory location
$phpEx = substr(strrchr(__FILE__, ‘.’), 1);
require_once($phpbb_root_path . ‘common.’ . $phpEx);function phpbbAutoLogin($id)
{
global $phpbb_root_path, $phpEx, $user;$user->session_kill(false);//Logout the User – For testing
$user->session_begin(); //Start Session
$user->session_create($id); //Create Session//Check if User has successfully Logged in
if($user->data[‘is_registered’]==1 && $user->data[‘user_type’] != USER_INACTIVE && $user->data[‘user_type’] != USER_IGNORE)
{
echo $user->data[‘username’] . ‘ has logged in’;
}
else
{
echo ‘Error Logging In’;
}
}//Auto Login User with phpBB User ID 52
phpbbAutoLogin(52);
?>
Questions? Please let me know!