Welcome <username> Help - I need some help

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Welcome <username> Help - I need some help

godlymoose
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.

Reply

palladin
When you guys learn to give a full information. Becose answer for you question is:

CODE

<?php
if (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 biggrin.gif


--------------------

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 cool.gif

Reply

godlymoose
I want to know if you can do something like this. I tried using something like this but it does not seem to work.

CODE

<?php
if ( $userdata['session_logged_in'] )
{
echo "Welcome " . $userdata['username'];
} else {
echo "Welcome guest, please log in.";
}
?>


Reply

palladin
It's look like part of bigger project smile.gif (exacly like phpbb wink.gif ) .. 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 smile.gif 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 cool.gif

 

 

 


Reply

squeezer
Maybe .... Hrgggg .. id ont know what to do !!

Reply

cragllo
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 ^^

Reply

HmmZ
Hmm, doesnt sound too hard o.O

heres my go >.>

CODE

//check if there is a user session
if($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 user
echo "".$welcome."".$user."";


Tell me if this works..if its not ill dig into PHPbb...

Reply

sarephina
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
B) 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:


CODE

$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:

CODE

'USERNAME' => $userdata['username'],




*** B) 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.


CODE

<!-- 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: http://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 "B)".

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : username

  1. What's The Real Member Behind The Username?
    (3)
  2. The Value Specified For The Package Username Field Is Not Valid.
    (2)
    QUOTE The value specified for the Package username field is not valid. What am i doing wrong?
    what does this field have to include? I'm trying to set it as karlosantana Forgive me for being
    dumn! thanks in advance karlos....
  3. Capturing Username Of Computer
    using javascript, is it possible? (3)
    I wondering if it is possible to try and make a java script to get the computer username and log it?
    /huh.gif" style="vertical-align:middle" emoid=":huh:" border="0" alt="huh.gif" /> edit Topic
    title ....
  4. Free Web Hosting Application! [screened] [approved]
    Username: <Reekun> / Website: <gnarfard.com> (2)
    To generate an application for free web hosting please click here: Free Web Hosting
    Request Form I would like to request free web hosting from Trap17. Please find my application
    below. Your Registered Domain Name or Desired Trap17 Subdomain Name: gnarfard.com
    Account Username: Reekun Introduction: Hi i'm reekun! :-) I am leader of
    Team Gnarfard, which is a bunch of guilds that spans across the mmorpgs Runescape, Neopets and
    Darkthrone! I'll try my best to spread the word about the Gnarfard clan! Hobb....
  5. I Need My Cpanel Username + Password [resolved]
    if possible can you email them to me (1)
    resolved please delete....
  6. Username Validation With Php
    (1)
    A simple method of validation. This is good if you dont want spaces between caracters: form.php
    CODE <FORM action="vali.php" method="post">     <P>
        <LABEL for="user">User name: </LABEL>     <INPUT
    type="text" id="user"><BR>     <INPUT type="submit"
    value="Send">     </P> </FORM> vali.php CODE <?php
    $user =$_POST['user']; $cuser=0; for($i=0;
    $i<strlen($u....
  7. What Does Your Username Mean?
    Your Trap17 name (76)
    On GaiaOnline.com, people in the forums say "le" before some things. For example: they say "le bump"
    or "le sigh" just to be random and silly. That's how I came up with "le" in my name. Krissy is
    short for my name, Kristen. So, that's how I came up with lekrissy. /tongue.gif"
    style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> What does your name mean?....
  8. Can I Have Multiple Accounts?
    On the same username. (3)
    Hi There, First off, I would like to congratulate you on a great service you are providing. The
    points for posting systems makes it feel like I am actually eraning my hosting instead. I have one
    quick question though /wink.gif" style="vertical-align:middle" emoid=";)" border="0"
    alt="wink.gif" /> Is it possible to have more than 1 hosting account on the same forum username?
    I am thinking of creating a new site, but I don't want to do it if I cannot host it with you.....
  9. Php Check If Username Is Taken
    (2)
    How would I go about making PHP check if a username is already registered? Thanks.....
  10. Xisto : Username Taken
    ^_^ (4)
    Hiya, I have to admit this problem might have been caused by me because of a premature refresh
    perhaps. After filling up the Xisto form and then clicking process I was brought to a blank page, I
    decided to let it load for about a few mins but to no avail on receiving any content. So I pressed
    the dreaded Button and bam all the text came out with the processing information appearing with a
    heartstopping Do Not Press Back or Refresh sign @_@. So, okay my bad. Is there anyway to help =)
    The desired domain is idle.trap17.com if there is someone taking it then ill settle f....
  11. Invalid Username/password During Account Activation
    (1)
    When I made my original request for a free web account, the instructions didn't seem to say that
    the username had to begin with an alphabeticaL character, so I chose one that began with a numeral.
    Now I can't activate my account. What do I do next? Thanks in advance for your reply and help.....
  12. How To Protect A Directory From Being Viewed
    without admin username and password (4)
    Well i ran across this script awhile back, and i am tired of storing it on my computer, so i am
    going to post it here and whenever i need it i will come here and get it /biggrin.gif"
    style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> hopefully Anyways, it is a
    verry simple process just copy and paste this QUOTE if (($user) && ($passwort)) {
    # get url $url = $DOCUMENT_ROOT . dirname($PHP_SELF) . "/.htpasswd"; # make
    .htaccess and .htpasswd $htaccess_txt = "AuthType Basic" . "\n"; $htaccess....
  13. I Need To Change Boozker To Ojproductions
    Im confused about the username and the url (4)
    I need to change it and i have looked in the search and i have found how to change the username, but
    if i change the username does that change everything? Does it change it here in the forums and my
    sub domain and my cpanel login? If i change it will all my files still be there? I'm sorry if
    i'm asking questions that were answered, but i looked and found mixed answers to the questions
    i'm asking. in other words i want ojproductions.trap17.com instead of my current
    boozker.trap17.com....
  14. Username Warning Percentage Question
    (2)
    i have a warning percentage of 10...how do you get these warnings? how can i find out how i have
    earned a warning? how do get rid of my warnings? what happens when your warning has reached the
    highest??....
  15. Help With Creating Account
    Invalid Username/Password (7)
    I need help on creating my hosting account. On the http://www.trap17.com/process/create_account.htm
    page, I type in the correct information. After clicking SUBMIT, I get an Invalid Username and
    Password error. I am sure my Password and Username is correct, any ideas?....
  16. Question: Changing Username?
    (1)
    Im just wondering if it is possible to change your username on this forum? And will it affect your
    website's account? And/or points? Thanks, Hope im not posting in the wrong area. =/....
  17. Broadband Internet Connection Restriction
    Prompt user for username and password (5)
    I have broadband internet connection and DI-704P router, Right now all users can connect to the
    internet. Is there any possible ways to make the internet connection be password protected? user
    must supply their username and password first to connect to internet. Is this possible? Tnx for
    any suggestion and tips /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> ....
  18. Problems Activating Hosting Account
    username and password invalid (10)
    I just got the email to start my trap17 site. I clicked on the link to
    http://www.trap17.com/process/ and filled out all of the appropriate information. My username
    was 8 characters, no special characters. My subdomain was re-atum, as edited from my forum handle
    since they don't allow the underscore. I don't know what is going on, and hopefully someone
    can help. Thanks in advance. ....
  19. Cpanel Username In Member Profile
    (5)
    I was wondering how I go about getting my cpanel username out of my form profile, I don't recall
    telling it to be there, and yet it is, and I can't figure out how to make it go away. It seems
    like a security flaw, afterall having a username is the first place to start hacking.....
  20. Can't Login
    my username and password is incorrect... (0)
    I accidently let the number of hosting days go to a (-) # of days, and then i brought it back up to
    a (+) number of days. Do I have to wait a certain amount of time or something before my account is
    reactivated? thanks.....
  21. Profile & Cpanel Username
    (5)
    Hello, I don't know if this has been suggested before or not, but I think that my Cpanel
    Username shouldn't be shown on my profile. This is potential problem; anyone that knows my site
    may visit this forum, access my profile and therefore get my cpanel username . I know, there is the
    password, but knowing the username a potential hacker would only need to find the pasword. Thanks
    /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> ....
  22. Influence For Username
    self-explanitory (31)
    I got this idea from the thread towards OpaQue influence. What is the influence for your username
    my username is Brawler because thats the name of my favourite plane in the game Total Annihilation.
    Thats the username i use for everything now.....
  23. The Story Behind My Username And Sig
    The Title tells it all, read on ;) (13)
    *NOTE* when the story is in Bold, that is Decessus speaking, and when it's underlined,
    that's Aevum speaking *END NOTE* Aevum Decessus I was once just another man, living my life
    like every other John Doe in society. Now, the very mention of my name has the ability to strike
    fear into the bravest of men. Whenever I arrive, the fear and panic of everyone present is palpable
    and electric. These emotions used to cause me great pain and suffering, but that can never compare
    to the suffering caused by my Master when I try to deny my namesake. I was once a simple m....
  24. Invalid Username And Password
    Any help would be much appreciated (4)
    Invalid Username and password Hey All! I’m having some trouble setting up my account. I made
    a thread requesting one, after I had the points, the topic got closed meaning everything was ok..
    But then when I try and go to http://www.trap17.com/process/ for the next step it says:
    Processing.. Please wait!. Do not hit RELOAD or BACK.. Username Validated. Connecting to
    Database... Database Connection Established. Validating username and password.. INVALID USERNAME AND
    PASSWORD! I know I typed my username and password correctly because I’ve been trying ever....
  25. Changing Username
    Do not want to loose my credits (2)
    Hi, Is there a way I can change my username? How involved or complicated would that change be?
    Would it take a long time? I no longer want to use my site for it originally inteded purpose.
    Therefore, I feel I need a new username to reflect my new idea. At the same time, I want a new
    username but I do not want to loose my credits. Am I screwed? Any help would be appreciated.
    Thanks.....
  26. Chane My Cpanel Username In The Trap17 Profile
    so I can get unsuspended (2)
    My cpanel name on my trap17 profile is not up to date. Please change it to "psych". If this isent
    why my site is suspended, please tell me. thanks.....
  27. Who Took Doomachine2000 As A Username?
    (0)
    I would like to know as that was mine originally but I noticed that was tken /huh.gif' border='0'
    style='vertical-align:middle' alt='huh.gif' /> /blink.gif' border='0'
    style='vertical-align:middle' alt='blink.gif' /> /sad.gif' border='0'
    style='vertical-align:middle' alt='sad.gif' /> ....
  28. Incorrect Username And Password?
    Why can't I set up my Free Hosting? (0)
    Yesterday I applied for hosting. It was accepted. Today I checked my e-mail's and got the
    message from Trap17, however upon going to the page and filling in my details, I got a message that
    my username and password were incorrect?! I'm sure they weren't, I know how to spell my
    username, and my password is hard to spell wrong. Can someone shed some light on why this happened?....
  29. My Cpanel =/= My Forum Username.
    What do I do?! (0)
    My forum username (as you can see) is Mike. However, my cpanel username is helljump. What should I
    do? (I already e-mailed support and got another e-mail from OpaQue)....
  30. I Recive Warning Mail From Trap17.com (= =")
    username forum not equal to cpanel name (9)
    I recive warning Email from trap17.com today. QUOTE Hi Members, NOTE : THIS IS A WARNING
    EMAIL FOR ALL MEMBERS WHO HAVE BEEN IN-ACTIVE FOR MORE THAN 3 WEEKS!  IF YOU is NOT equal
    to then MAIL the ADMIN ( support@trap17.com ) ASAP.  Mention the username of the forum and the
    cpanel clearly. All accounts whose forum usernames do not match Cpanel username, will be suspended.
    Atleast the first few characters ( more than 5 ) must match with the forums. Trap17 has been very
    generous with respect to the "INACTIVITY" rule till now. We have run our Inac....

    1. Looking for username

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for username

*MORE FROM TRAP17.COM*
Similar
What's The Real Member Behind The Username?
The Value Specified For The Package Username Field Is Not Valid.
Capturing Username Of Computer - using javascript, is it possible?
Free Web Hosting Application! [screened] [approved] - Username: <Reekun> / Website: <gnarfard.com>
I Need My Cpanel Username + Password [resolved] - if possible can you email them to me
Username Validation With Php
What Does Your Username Mean? - Your Trap17 name
Can I Have Multiple Accounts? - On the same username.
Php Check If Username Is Taken
Xisto : Username Taken - ^_^
Invalid Username/password During Account Activation
How To Protect A Directory From Being Viewed - without admin username and password
I Need To Change Boozker To Ojproductions - Im confused about the username and the url
Username Warning Percentage Question
Help With Creating Account - Invalid Username/Password
Question: Changing Username?
Broadband Internet Connection Restriction - Prompt user for username and password
Problems Activating Hosting Account - username and password invalid
Cpanel Username In Member Profile
Can't Login - my username and password is incorrect...
Profile & Cpanel Username
Influence For Username - self-explanitory
The Story Behind My Username And Sig - The Title tells it all, read on ;)
Invalid Username And Password - Any help would be much appreciated
Changing Username - Do not want to loose my credits
Chane My Cpanel Username In The Trap17 Profile - so I can get unsuspended
Who Took Doomachine2000 As A Username?
Incorrect Username And Password? - Why can't I set up my Free Hosting?
My Cpanel =/= My Forum Username. - What do I do?!
I Recive Warning Mail From Trap17.com (= =") - username forum not equal to cpanel name
advertisement



Welcome <username> Help - I need some help



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE