godlymoose 0 Report post Posted August 5, 2005 I already searched and I couldn't find a topic like this. But if there is I'm sorry. What I need help with is though. I need help having a "Welcome Guest" else "Welcome GodlyMoose". I want to put it on my index page also. I've looked everywhere and I cant find the code for it. I've tried making my own that failed. If I could use some help I would be very happy if someone could help me. Share this post Link to post Share on other sites
palladin 0 Report post Posted August 5, 2005 When you guys learn to give a full information. Becose answer for you question is: <?phpif (somthing){ print "Wlecome GodlyMoose";}else{ print "Welcome Guest";}?> Write for what you need them, meybe wanna change phbb forum or else, mebye you use sql, meby only cookies. How i can know what you wanna do --------------------Practice is when evrything work but no one know why.Theory is when work nothing but evry one know why.Programmers join Practice with Theory - nothing work and no one know why Share this post Link to post Share on other sites
godlymoose 0 Report post Posted August 5, 2005 I want to know if you can do something like this. I tried using something like this but it does not seem to work. <?phpif ( $userdata['session_logged_in'] ) { echo "Welcome " . $userdata['username'];} else { echo "Welcome guest, please log in.";}?> Share this post Link to post Share on other sites
palladin 0 Report post Posted August 5, 2005 It's look like part of bigger project (exacly like phpbb ) .. you just cut and paste this 6 lines i think. Ok lets start from begining: $userdata (is table variable) and must be declared earlier, like this $userdata['username'] = "Some guy"; $userdata[''session_logged_in'] = true; Above you got this what you missed and how you get this data to $userdata tabble variable ... it's depend what you use to collect data. Phpbb use sql + php session, declare this $userdata as session data and use then evry time when open page getting from session. Well if you write this two lines beforu you six lines, you get: Welcome Some guy message. -------------------- Practice is when evrything work but no one know why. Theory is when work nothing but evry one know why. Programmers join Practice with Theory - nothing work and no one know why Share this post Link to post Share on other sites
squeezer 0 Report post Posted August 9, 2005 Maybe .... Hrgggg .. id ont know what to do !! Share this post Link to post Share on other sites
cragllo 0 Report post Posted August 9, 2005 first off, you should have said you are doing it with phpbb, asuming you are bu looking at teh code you have given... if it is phpbb, say and i can help ^^ Share this post Link to post Share on other sites
HmmZ 0 Report post Posted August 15, 2005 Hmm, doesnt sound too hard o.Oheres my go >.> //check if there is a user sessionif($userdate['session_logged_in']==true){$log=$userdata['session_logged_in'];$welcome="Welcome back, ";$user=$userdata['username'];}else {$welcome="Please login or register, "";$user="Guest";}//Great the userecho "".$welcome."".$user.""; Tell me if this works..if its not ill dig into PHPbb... Share this post Link to post Share on other sites
sarephina 0 Report post Posted August 22, 2005 Hey, I think just got through the same problem in phpBB (if that's what you're using). I'm guessing about a lot of things regarding your problem, Godlymoose, but I hope this will help. Godlymoose, next time you ask for help, please be more detailed about your problem. For example, in this case, tell us what product you're trying to change the code for, and what results you got from what you tried to do--like any error messages, or weird code, or something. If you got a blank space, tell us that too. In the latest release of phpBB, the variable {USERNAME} is not defined (I have no idea why). PHP code will not work on template pages, and you must do a song and a dance to integrate separate pages into the phpBB system (see part "C)" of this post). Please let me know how this works out... == TABLE OF CONTENTS: == A) WHAT YOU MUST DO WHAT I THINK WILL DISPLAY EXACTLY WHAT YOU WANT C) HOW TO PUT THIS ONTO YOUR INDEX PAGE (if it's not part of phpBB) == CONTENTS: == *** A) WHAT YOU MUST DO: *** If you want to use {USERNAME} to display the username in a template, 1. OPEN includes/page_header.php from the root dir of the phpBB installation. 2. FIND the place where there's a long list of variables--it should start like this: $template->assign_vars(array( 'SITENAME' => $board_config['sitename'], 'SITE_DESCRIPTION' => $board_config['site_desc'], 3. And somewhere in there, before the array (the list) ends, INSERT this line: 'USERNAME' => $userdata['username'], *** WHAT I THINK WILL DISPLAY EXACTLY WHAT YOU WANT *** AFTER you make the changes in page_header.php, someone who isn't logged in will have the {USERNAME} "Anonymous," not "Guest." BUT You can go around this if you INSERT the following lines. <!-- BEGIN switch_user_logged_in -->Welcome, {USERNAME}<!-- END switch_user_logged_in --><!-- BEGIN switch_user_logged_out -->Welcome, Guest.<!-- END switch_user_logged_out --> *** C) HOW TO PUT THIS ONTO YOUR INDEX PAGE *** If you want to put this text on a page that's not part of your board, you must follow the instructions here: https://www.phpbb.com/kb/article.php?article_id=143 And then, wherever you want this text to show up on your index page, enter the code from part "". Share this post Link to post Share on other sites