Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: sign in

  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    New Coder
    Join Date
    Jun 2002
    Location
    London & Oxford
    Posts
    97
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try reading this through. There is an example at the bottom of the page:

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

    HTH
    As easy as 3.1415926535897932384626433832795028841

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I also have a sample registration/login script in ASP with Access 2000 database on my website for free.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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%>

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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. ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •