Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Have a users table....want a password column. 1

Status
Not open for further replies.

RZillmer

Programmer
Nov 20, 2001
42
US
I currently have a php website running off a mysql database. I have people do things like login, etc. Naturally, that means I have a table of users and have to store their passwords.

I am the only one that can actually get on the server and see the passwords in the user table, but I don't like the idea of them just being out there for me to see even....as lots of people like using the same password on multiple things. Is there some column type in mysql I should be using instead of just plain old text? Thanks in advance for any help.
 
MySQL does not have a password column type, but it does have a function password() ( password() produces a one-way hash -- once password() has had its way with the data, there is no way to recover the original info.

You can perform "INSERT userid, password('users_password')..." to put data into the table, and perform "SELECT...WHERE password = password('supplied password')" to attempt to retrieve the values.

______________________________________________________________________
TANSTAAFL!
 
you could use

a)mysql functions PASSWORD() or ENCRYPT() when inserting the password into the db

b)php to encrypt the password - mcrypt_ functions or maybe you create your own encryption algorithm ;-)
 
Making my own encryption algorithm does sound fun, but I am not THAT hard up for something to do. Thanks for pointing me in the right direction, guys (or girls...whatever the case may be).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top