Forum Moderators: open
All of our clients have a different password and what I would like to do is put a PW protected area on our site for client FAQs, tuts, etc. Now here is the catch.
I want the clients to be able to enter their pass into your basic, everyday, averag, textbox and hit "go" and have them login into the secure area of the site without a popup screen or what have you.
Can I just use .htaccess and enter all of our clients passwords and if so, how can I specificall attach it to the "go" image?
Is there a better solution using a database and php for instance?
Thank you for your ideas,
Khem
Do a simple login page with a form asking for Username and Password. Have the action of the form be the same page.
In the page, use server-side code like this: (This VB-ASP, but I'm sure it could be modified for php simply enough.)
<%
Function ValidUser(Username, Password)
strSQL = "SELECT * FROM users WHERE username = '" & Username & "' AND password = '" & Password & "'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strSQL, DBConn
If NOT rs.EOF Then ValidUser = True Else ValidUser = False
rs.Close
Set rs = Nothing
End FunctionIf Request.Form("Username") <> "" Then
Username = Request.Form("Username")
Password = Request.Form("Password")
If ValidUser(Username, Password) Then
Session("LoggedIn") = True
Response.Redirect [The Secure Area of Your Site]
Else
Session("LoggedIn") = False
End IF
End If
%>
[id:pass@mydomain.com...]
Where id and pass are what the visitor enters on your form.