Click to See Complete Forum and Search --> : Login using SQL id
achat
04-25-2003, 01:05 AM
I ave some pages on my site which draw info from our SQL server. I have configured a login script which runs off a password.txt file where i have the user names and password. I would like to use the ids created for these users in sql and authenticate them using the pwd given by then in sql. this way i need not maintain a txt file.
AdamGundry
04-25-2003, 02:58 AM
If I understand you right, you need to create a password field in your table (make it a large VARCHAR), then you can test for a valid login using the following:
select * from table where userid='whatever' and password=MD5('whatever')
Note this is using MD5 encryption on the password field, so when you initally store the password you need to use MD5 as well.
The exact syntax depends on the language you are using to write the pages (e.g. PHP, ASP) and the SQL server being used (e.g. MySQL, Oracle).
Adam
achat
04-25-2003, 04:32 AM
No, I already have some users registered in MSSQL and they have passwords stored in system tables. I would like to use these.
AdamGundry
04-25-2003, 05:23 AM
Oh, I see. You should still be able to use a select statement on the tables, like the one above (you can in MySql, I'm afraid I'm not familiar with MSSQL). Again, there should be a function to put a password into the table, e.g. in MySql it is PASSWORD().
Adam