2012-05-06, 12:04 AM
Im trying to make a login box which is on the index page outside the forum root. Using this code from another post:
above any other code:
login form thing
The problem im having is that for some reason it while im logged in on the forum doesnt show this on the main site. It constantly shows the else loop.
Asking to sign it while the user is already signed in. Any solutions for this problem would be really welcome.
Also i tried it with the normal portal page (pulling it out of the root and have the same issue there) with telling me " hello guest ... loging/register etc. "
Has something to do with the fact that the page doesnt find all of the mybb cookies for some reason.
Jup has to do with the cookies.
My cookie path is /forum/ so apparently that means they are only accessible by that folder (/forum/).
What would happen if i make it / again to make it the cookies set to the root. Would the cookie then still be accessible by Mybb? and accessible through out the whole domain ?
How do i use
above any other code:
<?php
chdir('forums'); // path to MyBB
define("IN_MYBB", 1);
require './global.php';
?>
login form thing
if($mybb->user['uid'])
{
// The user is logged in, say Hi
echo "Hey, $mybbuser[username].<br />
Thanks for logging in.<br />";
echo "<a href=\"{$mybb->settings['bburl']}/private.php\">{$lang->welcome_pms}</a> {$lang->welcome_pms_usage}";
}
else
{
// The user is not logged in, Display the form
echo "<form action='forum/member.php' method='post'>
Username: <input type='text' name='username' size='25' maxlength='30' style='border-radius:10px;' /><br />
Password: <input type='password' name='password' size='25' style='border-radius:10px;' />
<input type='hidden' name='action' value='do_login'>
<input type='hidden' name='url' value='index.php' />
<input type='submit' class='submit' name='submit' value='Login'/></form><br>";
}
?>
The problem im having is that for some reason it while im logged in on the forum doesnt show this on the main site. It constantly shows the else loop.
Asking to sign it while the user is already signed in. Any solutions for this problem would be really welcome.
Also i tried it with the normal portal page (pulling it out of the root and have the same issue there) with telling me " hello guest ... loging/register etc. "
Has something to do with the fact that the page doesnt find all of the mybb cookies for some reason.
Jup has to do with the cookies.
My cookie path is /forum/ so apparently that means they are only accessible by that folder (/forum/).
What would happen if i make it / again to make it the cookies set to the root. Would the cookie then still be accessible by Mybb? and accessible through out the whole domain ?
How do i use
$mybb->cookies['name'];
To get the cookies needed for the above code?