Jump to the post that solved this thread.
Not Solved Logged Out on External Page
#1
Not Solved
SOLUTION: Cookie path needs to be "/" (without the quotes) for this to work.

So I have created a custom page and used the php code below to login the user, check the username, and check the usergroup. When I visit the page I am logged out even though I am logged in on the forums. Any help is appreciated. Smile

<DIRNAME> is just my directory name that I want to keep private.

My forum is located inside a folder in public_html. (public_html/forums)


If you need my forum URL please contact me privately. I will give proof of purchase to the theme I am using to any MyBB staff that ask.

<?php
chdir('home/<DIRNAME>/public_html/forums'); // path to MyBB
define("IN_MYBB", 1);
require_once "../forums/global.php";
if(in_array($mybb->user['usergroup'] , array(1,7,5,18,19)))
{
error_no_permission();
}
// Rest of code
if($mybb->user['uid'] > 0)
{
    $uid  = $mybb->user['uid'];
    $user = get_user($uid);
    $name = $user['username'];
}
?>
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)