PDA

View Full Version : sign in


ahmedsoliman
06-20-2002, 07:44 PM
how can i know if a user name and password enterd by members in my site is valid and exist in my database

head8k
06-20-2002, 08:55 PM
Try reading this through. There is an example at the bottom of the page:

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

HTH

whammy
06-21-2002, 02:11 AM
I also have a sample registration/login script in ASP with Access 2000 database on my website for free.

ahmedsoliman
06-21-2002, 11:33 PM
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%>

whammy
06-22-2002, 01:43 AM
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

:)