+ Reply to Thread
Results 1 to 5 of 5

Thread: Driving me crazy

  1. #1
    earthinc is offline Banned earthinc is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    104

    Driving me crazy

    Hi
    I'm trying to simply make my link that says Login change to "Welcome, [membername]", and the option to log out, when they are logged in. Can I please get some help with this??? :dunno:
    Last edited by earthinc; 01-23-2010 at 08:10 PM.

  2. #2
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    Re: Driving me crazy

    Check out this article: http://www.howtodothings.com/compute...r-your-website

    It should explain everything you need to know. I tried to answer this question myself, but it is way too general. When asking a question, it should be pretty specific. Some examples would be to ask where to learn how to make a login system, or why you are having problems making yours with the problematic code in your post. It just makes it easier to answer
    Last edited by Twinkie; 01-23-2010 at 11:03 PM.

  3. #3
    xgreenberetx is offline x10Hosting Member xgreenberetx is an unknown quantity at this point
    Join Date
    Oct 2009
    Posts
    57

    Re: Driving me crazy

    if you are using php you can do.
    Code:
    <?php
    if(!isset)
    { 
    echo "welcome, Guest";
    //show the login form
     }
    else
    {
     echo "welcome, $username";
     }
    ?>
    There is more to this of coarse but it is an outline.
    Last edited by xgreenberetx; 01-24-2010 at 11:36 AM.

  4. #4
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    Re: Driving me crazy

    Quote Originally Posted by xgreenberetx View Post
    if you are using php you can do.
    Code:
    <?php
    if(!isset)
    { 
    echo "welcome, Guest";
    //show the login form
     }
    else
    {
     echo "welcome, $username";
     }
    ?>
    There is more to this of coarse but it is an outline.
    Code:
    if(!isset($_GET['user']))
    { 
    echo "welcome, Guest";
    //show the login form
     }
    else
    {
     echo "welcome, $username";
     }
    The isset function checks whether a variable is set. GET and POST variables are automatically filled out when you submit a form. I think you meant to check whether the user submitted a form by checking whether a certain form variable has been set (corrected above). However, if you want the user name to be remembered on page refresh, you would have to store it is a session (or some other data keeper).
    Code:
    session_start();
    
    if (!isset($_GET['user']) && !isset($_SESSION['user'])) {
      echo 'Welcome, guest.';
      //Display form
    } else if (isset($_GET['user']) && !isset($_SESSION['user'])) {
      $_SESSION['user'] = $_GET['user'];
      echo 'Welcome, ' . $_SESSION['user'];
    } else {
      echo 'Welcome, ' . $_SESSION['user'];
    }
    The next step would be to use a database to verify the user name is registered with your site.

    More information:
    http://w3schools.com/php/php_get.asp
    http://w3schools.com/php/php_sessions.asp

    I would recommend completing at least the w3schools tutorial in PHP before continuing. You cannot effectively understand a script if you are not versed in PHP's basics.

  5. #5
    marc316 is offline x10Hosting Member marc316 is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    21

    Re: Driving me crazy

    nice, kind helped me with a different script.

+ Reply to Thread

Similar Threads

  1. Google Maps Driving Simulator Lets You 'Drive' Anywhere
    By AceNik in forum Computers & Technology
    Replies: 14
    Last Post: 06-28-2008, 08:21 PM
  2. this is crazy
    By dazza in forum Free Hosting
    Replies: 2
    Last Post: 12-22-2005, 06:37 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