Helpful Information
 
 
Category: ASP
sign in

how can i know if a user name and password enterd by members in my site is valid and exist in my database

Try reading this through. There is an example at the bottom of the page:

http://www.asp101.com/samples/login.asp

HTH

I also have a sample registration/login script in ASP with Access 2000 database on my website for free.

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 ?? :confused:

<%
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%>

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

:)










privacy (GDPR)