tags:

views:

94

answers:

4

HI ,

I am stuck with a little thing,

I need to allow muplite users to be able to login

my php code works with one member how can I make it so mulitple users can login,

If there is a better way using MySql please let me know

    $upload_username = "username";
    $upload_password = "password";

Thanks

+8  A: 

Yes, you want to set up a table to store usernames, passwords, and such. here is a great tutorial explaining how to set up a site login in PHP:

User Membership with PHP

GSto
+1 Thats a very good tutorial that you linked to.
Vincent Ramdhanie
Best Answer +1 and a tick from me. Thanks dude
Oliver Bayes-Shelton
+1  A: 

First i would encrypt passwords whether you hard code them or whether they are in a database. But it is best to store user accounts in a secure database with the passwords encrypted.

Lizard
+2  A: 

This is a very broad question. Here are a few ideas:

  1. create a table called site_users that will store username, password and other user details
  2. Create a login form to capture the username and password
  3. On submit, query the site_users table for the username password combo. If found then set a session token that indicates that this user has succefully logged in
  4. on each page of your site check for the session token. You may do this with an include page to avoid repeating code.
Vincent Ramdhanie
Thanks , We actually have this working on one of our other sites , I just wanted 1 additional user so didn't want to use sessions but I guess I should future proof the site. Thanks
Oliver Bayes-Shelton
A: 

A combination of a database (with encrypted password), php and sessions is a good solution.

Per Östlund