PDA

View Full Version : Username on Non-VB Page


ohspot
04-09-2003, 11:07 AM
I'm trying to print a message either welcoming members back, or if they are not logged in, asking them to either login or register.

I have tried This




<?

require("forums/global.php");

if ($bbuserinfo['userid']!=0) {
$username=$bbuserinfo['username'];

echo "Welcome back, <b>$username</b>";

}

?>


But can't get it to work. Basically, I want one of the following messages:

Welcome Back, USERNAME

OR

Please Login or Register To Interact In Our Community.

With the words Login, Register & Community being hyperlinks to their respective areas.

This page/message will be outside the forums directory.

Thanks in advance for any help!!

:)

mr e
04-10-2003, 04:36 PM
i might be missing something but try this

require("./forums/global.php");

filburt1
04-10-2003, 04:56 PM
You're not defining the opposite case.

chdir("./forums");
require("global.php");

if ($bbuserinfo['userid'] == 0)
{
echo "you're a guest";
}
else
{
echo "Just kidding, you're " . $bbuserinfo['username'];
}

ohspot
04-10-2003, 09:16 PM
Hmmm... I tried both tid bits of code, and here is what I get:

Warning: Cannot modify header information - headers already sent by (output started at /home/ohsppigz/public_html/1index.php:8) in /home/ohsppigz/public_html/forums/admin/functions.php on line 1660
you're a guest

Also, how did you get your signature? I've seen those images with forum stats all over thie forum, is there a hack that allows you to do that or something - very nice.

And thanks for the help!

ohspot
04-10-2003, 09:20 PM
I tried saving the code in a seperate file (welcome.php) and I didn't get the header information - however, it always shows up as guest - even though I'm logged in.

I even tried logging in then being redirected back to the welcome.php page - same thing, you are a guest.

:banana: