dturnbull Posted May 13, 2006 Share Posted May 13, 2006 I have a really simple database/script.Users sign up with an email, username, and password (and some other fields), and then a new page is created for them with their details. Could someone give me some help on how to make it so users can use their email/password to login then update their details? Quote Link to comment Share on other sites More sharing options...
hvle Posted May 13, 2006 Share Posted May 13, 2006 [!--quoteo(post=373416:date=May 13 2006, 02:14 PM:name=David Turnbull)--][div class=\'quotetop\']QUOTE(David Turnbull @ May 13 2006, 02:14 PM) [snapback]373416[/snapback][/div][div class=\'quotemain\'][!--quotec--]I have a really simple database/script.Users sign up with an email, username, and password (and some other fields), and then a new page is created for them with their details. Could someone give me some help on how to make it so users can use their email/password to login then update their details?[/quote]I can not write the entire code for you, but here is the designing:1. Set up your database, make sure all the field names and field datatypes are good in place.2. Write a Register.php file. This page contain a registration form for new user to register. Registration will be consistent with the fields in your database table.3. Write a Login.php file. This file contain a login form (username and password). when click submit, it will check against database. If verified, redirect to the profile.php, otherwise, stay on the same login with a message.4. the profile.php, This file contain a very similar form as registration, but instead with a update button at the bottom. profile.php first read the data for this user from db, then parse them to the form. Quote Link to comment Share on other sites More sharing options...
dturnbull Posted May 13, 2006 Author Share Posted May 13, 2006 How would I check the username/password against the database? that is wat I am having troubles with. Quote Link to comment Share on other sites More sharing options...
hvle Posted May 13, 2006 Share Posted May 13, 2006 [!--quoteo(post=373427:date=May 13 2006, 03:41 PM:name=David Turnbull)--][div class=\'quotetop\']QUOTE(David Turnbull @ May 13 2006, 03:41 PM) [snapback]373427[/snapback][/div][div class=\'quotemain\'][!--quotec--]How would I check the username/password against the database? that is wat I am having troubles with.[/quote]this is where sql come in.One most common way to do this, is to query the database, check to see if there exist a record with that given username and given password.if there is, then the username and password match, since username is unique, there is only 1 record that able to match a given username and password.sample query:$rs = mysql_query("select count(*) as count from tablename where username='$username' and password='$password'");if (mysql_num_rows($rs) == 1){ echo 'password and username is correct';}else{ echo 'password username did not match';}tablename is the table in db that contain user registration information.$username, $password are retrieve from login form. Quote Link to comment Share on other sites More sharing options...
448191 Posted May 13, 2006 Share Posted May 13, 2006 There are TONS of simple membership tutorials on the net. Take one. Quote Link to comment Share on other sites More sharing options...
dturnbull Posted May 13, 2006 Author Share Posted May 13, 2006 thnx for the help. worked great. Quote Link to comment Share on other sites More sharing options...
Flukey Posted May 13, 2006 Share Posted May 13, 2006 Store the password as an MD5 hash. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.