Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 10 Years, 8 Months, 1 Week ago Output $name ?
#1
Solved: 10 Years, 8 Months, 1 Week ago
I have MyBB installed at ./forums folder.

I have another page named profile.php at root. Below is part of code from profile.php .

<?php
define("IN_MYBB", 1);
require ('forums/global.php');
if($mybb->user['uid'] > 0)
{
    $uid  = $mybb->user['uid'];
    $user = get_user($uid);
    $name = $user['username'];
	echo $name;
}
else {
echo "You are not logged in!"; }
?>

Am I right to say that it will output $name if I had already logged into MyBB Forums? However, it keep telling me "You are not logged in!" .

Those file have not been uploaded to any server online yet. I'm testing it using my Localhost [WAMP Server]
Bitcoin Donation Address: 1JTKeHGEjFtJ3X2M8TCt1WvT1e2cDkgUHf
#2
Solved: 10 Years, 8 Months, 1 Week ago
Right after require ('forums/global.php'); type the following and post the results.
echo var_dump(MYBB_ROOT, $mybb->user);
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
#3
Solved: 10 Years, 8 Months, 1 Week ago
This is my edited code,
define("IN_MYBB", 1);
require ('forums/global.php');
echo var_dump(MYBB_ROOT, $mybb->user);
?>

What to do next? It output:

Quote:string 'C:\wamp\www\Personal\Milkmon\forums/' (length=36)

array (size=6)
'usergroup' => int 1
'username' => string '' (length=0)
'uid' => int 0
'displaygroup' => int 1
'lastvisit' => int 1399011567
'ismoderator' => boolean false

I logged in, the username and uid are always blank and zero.

Thanks for helping. I found another way to do that myself.
Bitcoin Donation Address: 1JTKeHGEjFtJ3X2M8TCt1WvT1e2cDkgUHf


Forum Jump:


Users browsing this thread: 1 Guest(s)