PDA

View Full Version : HMTL - Adding extra logins



Student31
Mar 13th, 2008, 01:15 PM
Hi, I am doing a web application in HTML and using a login system for the first page the user visits... but at the moment I can only get the login page to accept the username admin and password admin. below is the code I have used for this:

<%
Sub CheckLoginForm
If Request.Form("username") = "admin" AND Request.Form("password") = "admin"
Then
Session("BlnLoggedIn") = True
Response.Redirect "Index.aspx"
Else
Response.Write "<div align='center'>Incorrect Password Try Again.</div><br>"
ShowLoginForm
End If
End Sub
%>

So... if they try anything else then it fails to login, but how do I succesfully add more usernames? Im not too sure, I tried an IF statement but this wouldnt work.

Thanks a lot for any help.

rangana
Mar 13th, 2008, 01:25 PM
This one is ASP, it should be in the ASP section ;)

Anyway, have you tried adding an or statement in your if??
Something like:


If Request.Form("username") = "admin" AND Request.Form("password") = "admin" or
Request.Form("username") = "visitor" AND Request.Form("password") = "visitor"

Why is your query like this??..Haven't you decided to save it in a database and do some queries. This is vulnerable for attacks :(

Student31
Mar 13th, 2008, 01:31 PM
Im just doing a basic login for now...

BUT as you said, I did try to query it to a database that I have made for other usernames and passwords... but I cant figure out how to make the code find the database with the stored information. :( New to this, sorry!

jlhaslip
Mar 14th, 2008, 03:13 AM
Should still re-post this in the ASP Forum.