How to capture and valid user session

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • xo55ox

    How to capture and valid user session

    Hi,

    I just build a website and need to somehow trap the user logon and

    1) display 'welcome! so and so' at the left hand corner of the page.
    2) valid whether the user exists in my MySQL database, user table.

    How do I do that?

    Thanks for your help!
  • Tim Van Wassenhove

    #2
    Re: How to capture and valid user session

    On 2003-12-08, xo55ox <xo55ox@hotmail .com> wrote:[color=blue]
    > Hi,
    >
    > I just build a website and need to somehow trap the user logon and
    >
    > 1) display 'welcome! so and so' at the left hand corner of the page.
    > 2) valid whether the user exists in my MySQL database, user table.[/color]

    You could start with reading the manual at http://www.php.net/manual/nl

    Looking at the source-code of phpmyadmin will give you an example howto
    code this. Buf if you have read, and understood the manual, i think
    you'll be able to come up with this basic stuff yourself.

    --
    verum ipsum factum

    Comment

    • Robert Downes

      #3
      Re: How to capture and valid user session

      xo55ox wrote:
      [color=blue]
      > Hi,
      >
      > I just build a website and need to somehow trap the user logon and
      >
      > 1) display 'welcome! so and so' at the left hand corner of the page.
      > 2) valid whether the user exists in my MySQL database, user table.[/color]

      You could see the section in the manual on 'HTTP authentication with
      PHP', but I think that method is clunky and annoying, especially if you
      are testing a script and need to login and logout of different accounts.

      Instead, I use cookies to store the username and password. It's not
      secure, but my ISP does not offer SSL, so nothing I run will be secure.
      However, make sure to offer an option of session-only logins by setting
      no expiry date for the cookie. That way, once the browser is closed, the
      cookie is deleted (or marked for deletion). Supposedly. The problem with
      cookies is their client-side nature - you have to rely on the browser to
      do its job properly.

      You seem very new to PHP, and your questions can't easily be answered in
      a usenet group. I recommend you go and find as many example PHP scripts
      as you can, and see how they handle authentication of users.
      --
      Bob
      London, UK
      echo Mail fefsensmrrjyahe eoceoq\! | tr "jefroq\!" "@obe.uk"

      Comment

      • Paul

        #4
        Re: How to capture and valid user session

        Hi,

        Easiest way is to set a cookie when the user has logged on. When he
        returns (or after logon) check the logon information (and retrieve the
        name) in the mysql database by doing a query on your user table.


        xo55ox@hotmail. com (xo55ox) wrote in message news:<abbcb3d7. 0312072153.44ab 9231@posting.go ogle.com>...[color=blue]
        > Hi,
        >
        > I just build a website and need to somehow trap the user logon and
        >
        > 1) display 'welcome! so and so' at the left hand corner of the page.
        > 2) valid whether the user exists in my MySQL database, user table.
        >
        > How do I do that?
        >
        > Thanks for your help![/color]

        Comment

        Working...