how can i know if a user name and password enterd by members in my site is valid and exist in my database
Announcement
Collapse
No announcement yet.
sign in
Collapse
X
-
Try reading this through. There is an example at the bottom of the page:
HTHAs easy as 3.1415926535897932384626433832795028841
-
thank you this file will be very usefull for me,but i as abeginner in asp i wrote a simple script to do the same function but it dosen't work why ??
<%
inname=request.form ("username")
inpsd=requset.form("password")
%>
<% set com=server.CreateObject ("adodb.connection")
com.Open ("toto")
sql="select (uname,password) from table1"
set rs=com.Execute (sql)
while not rs.eof%>
<%
if rs(2)=="inname" then
if rs(3)=="inpsd" then
Response.Write (inname)
Response.Write (inpsd)
flag=1
rs.movenext
wend%>
<% msg="wrong username or password"
if flag!=1 then%>
<%=msg%>
Comment
-
Try this instead:
sql="SELECT uname,password FROM table1 WHERE uname = '" & uname & "' AND password = '" & password & "' "
set rs=com.Execute (sql)
IF NOT rs.EOF THEN
'username and password both match
ELSE
'redirect them somewhere or make them login again
END IF
Former ASP Forum Moderator - I'm back!
If you can teach yourself how to learn, you can learn anything. ;)
Comment
Comment