Welcome to Dream.In.Code
Getting Help is Easy!

Join 109,297 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,213 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



database users

 
Reply to this topicStart new topic

database users

jamesb
post 1 Jul, 2008 - 05:38 AM
Post #1


New D.I.C Head

*
Joined: 24 Jun, 2008
Posts: 17


My Contributions


I have MySQL on my xp machine here at work and am going through the tutorial in the MySQL 5.0 Reference Manual.

Manual link

And I am not very far in it, but I believe I found a question that the tutorial won't cover. If I were to have a database on the internet for a site that users had to log into...would I need a database user for each website login or could all web users have the same database username?
User is offlineProfile CardPM

Go to the top of the page


orcasquall
post 1 Jul, 2008 - 08:43 AM
Post #2


D.I.C Head

Group Icon
Joined: 14 Sep, 2007
Posts: 155



Dream Kudos: 50
My Contributions


I'm assuming you want your site to be popular (obvious I know, but still need to state...). Since that's the case, creating an individual database user for every user would be tedious, to say the least. Perhaps even undesirable.

Create a database user with just enough rights to do whatever a web visitor can do. Then whenever a database connection is needed, use that special user ID.

I suggest using a database table to store user information, one record for every user. Of the columns for this table, two are the most important, the user login ID, and the associated password.

You do know how to encrypt passwords right? Storing a hash of the plaintext password is usually the norm.

Then when a user logs in, connect to the database with the special ID, then check if the user-given ID exists in the database, together with the correct password. If all goes well, log the user in.

This is how I'd do it. Any experts reading this, please give your thoughts too. I'd love to hear any alternatives.
User is offlineProfile CardPM

Go to the top of the page

jamesb
post 1 Jul, 2008 - 09:15 AM
Post #3


New D.I.C Head

*
Joined: 24 Jun, 2008
Posts: 17


My Contributions


QUOTE(orcasquall @ 1 Jul, 2008 - 08:43 AM) *

I'm assuming you want your site to be popular (obvious I know, but still need to state...). Since that's the case, creating an individual database user for every user would be tedious, to say the least. Perhaps even undesirable.

Create a database user with just enough rights to do whatever a web visitor can do. Then whenever a database connection is needed, use that special user ID.


Popularity is null, simply looking at how things can be done; database philosophy?

But you say it can be done both ways, thanks!
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/6/08 09:45AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month