Remote Login for Subdomain Hosted Forum

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
codymatthew
Registered User
Posts: 57
Joined: Tue Sep 26, 2017 9:48 pm

Remote Login for Subdomain Hosted Forum

Post by codymatthew »

I am looking for a remote login script to log into phpbb. My phpbb is on a subdomain and I need the login script to run from the top domain.
I've tried this and a cookie is created, but on the redirect to the forum, it shows not logged in.

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = 'forum/';

$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.php');
include($phpbb_root_path . 'includes/functions_user.php');
include($phpbb_root_path . 'includes/ucp/ucp_register.php');

$password='xxxxx';
$username='xxxxx';

$user->session_begin();
$auth->acl($user->data);
$user->setup();
$username = request_var($username, '');
$password = request_var($password, '');

if(isset($username) && isset($password))
{
  $auth->login($username, $password, true);
  header("Location: https://my.townhub.org/");
}
The cookie domain shows

Code: Select all

.townhub.org
Post Reply

Return to “phpBB Custom Coding”