+ Reply to Thread
Results 1 to 5 of 5
Like Tree2Likes
  • 1 Post By burner35
  • 1 Post By webboy93

Thread: Display User Login after user has logged in.

  1. #1
    burner35's Avatar
    burner35 is offline x10 Sophmore burner35 is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Australia
    Posts
    127

    Question Display User Login after user has logged in.

    Hello all,

    I am looking for the php code to display the user login after:
    > User has joined
    > user has logged out
    Example:
    > Welcome example to example!

    And:
    To display this when the user is a guest
    > Welcome Guest to Example!

    I have been unsuccessful of my Yahoo, Google searches

    Cheers,
    burner35
    dinomirt96 likes this.
    Within the TrackMania Community, they know me as fastforza!

  2. #2
    webboy93 is offline x10Hosting Member webboy93 is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    1

    Re: Display User Login after user has logged in.

    Welcome <? fetch->$name ?> to example


    Change $name to the correct.
    karimirt47 likes this.

  3. #3
    burner35's Avatar
    burner35 is offline x10 Sophmore burner35 is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Australia
    Posts
    127

    Re: Display User Login after user has logged in.

    But is there any other info like select table name, DB info and so on?
    Within the TrackMania Community, they know me as fastforza!

  4. #4
    Salvatos's Avatar
    Salvatos is offline x10 Lieutenant Salvatos is an unknown quantity at this point
    Join Date
    Jun 2006
    Location
    Québec, Canada
    Posts
    271

    Re: Display User Login after user has logged in.

    I think the easiest way would be to set a session variable. When you validate the user's logging in, you most likely make a query to your DB to check if the login and password match. If they do, you can do something like this:

    Code:
    (If the user has logged in succesfully)
    $_SESSION[logged_in] = TRUE;
    $_SESSION[user_login] = (either your $_POST[login] or your result from the database);
    Then on any page (as long as you start it with session_start() of course), you can echo something like this:

    Code:
    if ($_SESSION[logged_in] == TRUE) {
    echo 'Hello '.$_SESSION[user_login].', welcome to my website.';
    }
    else {
    echo 'Hello guest, welcome to my website. Why not sign up for free?';
    }

    P.S. When I say it may be the easiest way, that's according to my limited PHP/SQL skills. I've been using something similar and it works perfectly. Hope that helps anyway.
    Last edited by Salvatos; 08-13-2008 at 05:24 PM. Reason: Typo

  5. #5
    burner35's Avatar
    burner35 is offline x10 Sophmore burner35 is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Australia
    Posts
    127

    Re: Display User Login after user has logged in.

    Ok Cheers m8
    Within the TrackMania Community, they know me as fastforza!

+ Reply to Thread

Similar Threads

  1. Login Problem
    By Singard in forum Free Hosting
    Replies: 16
    Last Post: 05-31-2007, 10:02 AM
  2. A simple Visual Basic Login Form
    By Zenax in forum Tutorials
    Replies: 0
    Last Post: 03-13-2007, 08:59 AM
  3. User Panel Login
    By Prat92 in forum Free Hosting
    Replies: 2
    Last Post: 03-25-2006, 10:01 AM
  4. Cant see the site and login to cpanel
    By Jxwisniewski in forum Free Hosting
    Replies: 1
    Last Post: 04-05-2005, 04:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers