I'm creating a code outside of the forums, and it will show your username after you logon in the top corner saying "Logged in as (username)'. I have almost all the code down, except the part that shows your username.
Code: Select all
<?PHP
define('IN_PHPBB', true);
$phpbb_root_path = './bbs/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('ucp');
?>
<Javascript code here>
<?PHP
if ($user->data ['is_registered'])
{
echo "Logged in as (username). ";
echo '<BR><BR><a href="'.$phpbb_root_path.'/ucp.php?mode=logout&sid='.$user->data['session_id'].'&redirect='.$returnAddress.'">Logout</a>';
}
else{
echo "<DIV id=\"loginbox_button\"><table width=\"219\" border=\"0\">";
echo "<tr>";
echo "<span onmouseup=\"HideDIV('loginbox_button');DisplayDIV('loginbox_itself')\" style=\"cursor:pointer\"><img border=\"0\" align=\"left\" src=\"loginbutton.png\"></span> <a href=\"javascript:poptastic('/bbs/ucp.php?mode=register', 'Register');\"> <img border=\"0\" align=\"right\" src=\"registerbutton.png\"> </a>";
echo "</tr>";
echo "</table></DIV>";
echo "<DIV align=\"left\" id=\"loginbox_itself\" style=\"display:none\"><table width=\"219\" border=\"0\">";
echo "<tr>";
echo "<form action=\"./bbs/ucp.php?mode=login\" method=\"POST\">";
echo "<span class=\"genmed\">Username:</span> <input class=\"POST\" type=\"text\" name=\"username\" maxlength=\"30\" /><BR><span class=\"genmed\">Password:</span> <input class=\"POST\" type=\"password\" name=\"password\" maxlength=\"30\" /><BR><span class=\"gensmall\">Log me on automatically each visit </span> <input type=\"checkbox\" class=\"radio\" name=\"autologin\" /><BR><input type=\"submit\" class=\"btnmain\" name=\"login\" value=\"Login\" />";
echo "</form>";
echo "<BR>Make sure you refresh after you comeback to see your stuff, or after you logout...";
echo "</tr>";
echo "</table></DIV>";
}
?>
Code: Select all
echo "Logged in as (username). ";
A) breaks the page
or
B) when I'm logged in it says "Logged in as ." without any username.
Sorry if I sound really stupid.