The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Page 1 of 2 12 LastLast
Results 1 to 15 of 20

Thread: ASP : im really stumped

  1. #1

    ASP : im really stumped

    Ok, im making a news updating panel for my bands site.

    i have all of it down, exept the looging in part.

    this is waht i have.

    Code:
     
    
    <html> <head> <% username = Request.Form("username") password = Request.Form("password") Set Conn = Server.CreateObject("ADODB.Connection") lpath = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("main.mdb") Conn.Open(lpath) set RS = Server.CreateObject("ADODB.Recordset") RS.Open "SELECT username, password, level FROM members WHERE username LIKE" & username & "AND password LIKE " & password & ";", Conn If Not(RS.EOF) then Session("username") = RS.fields.item("username") Session("login") = 1 Session("level") = RS.fields.item("level") if Session("login") = 1 AND Session("level") >1 then Response.Redirect("default.asp?s=loggedin") ELSE Response.Redirect("default.asp?s=badinfo") end if RS.close set Rs = nothing end if Conn.close set Conn = nothing %> </head> <body> </body> </html>

    thats where i point the login from to. All i get is a 500 error. I really dont know whats going on with it.


    thanks for any help

  2. #2
    2 things

    1. think you need single quotes in the SQL statement
    SELECT username, password, level FROM members WHERE username LIKE '" & username & "' AND password LIKE '" & password & "';"

    2. if rs.EOF is nothing then you don't have the page redirecting anywhere

    try these changes and let me know how it goes
    now with blog, click here

  3. #3
    thanks for the help. I never really learned what "EOF" ment, and i could never find anything on the web that would tell me waht it is... so, i know this is really basic, but wahts "EOF"?

  4. #4
    EOF means end of file...can't say much more than that.

  5. #5
    oh, now i feel stupid, haha.

    anyway, i looked over the code, and this is what i did...

    Code:
     <%
    username = Request.Form("username")
    password = Request.Form("password")
     
    Set Conn = Server.CreateObject("ADODB.Connection")
    lpath = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("main.mdb")
    Conn.Open(lpath)
    set RS = Server.CreateObject("ADODB.Recordset")
    RS.Open "SELECT username, password, level FROM members WHERE username LIKE" & username & ";", Conn
    If RS.EOF then 
    Response.Redirect("defualt.asp?s=badinfo")
    ELSE
    Session("username") = RS.fields.item("username")
    Session("login") = 1
    Session("level") = RS.fields.item("level")
    if Session("login") = 1 AND Session("level") >1 then
    Response.Redirect("home.asp")
     
    end if 
    RS.close
    set RS = nothing
    end if
    Conn.close
    set Conn = nothing
    %>

  6. #6
    does it work
    now with blog, click here

  7. #7
    no

  8. #8
    OK, this is the WHOLE "logincheck.asp" page.....


    Code:
     <html>
    <head>
    <link rel="stylesheet" type="text/css" href="standard.css">
    <%
    username = Request.Form("username")
    password = Request.Form("password")
     
    Set Conn = Server.CreateObject("ADODB.Connection")
    lpath = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("main.mdb")
    Conn.Open(lpath)
    set RS = Server.CreateObject("ADODB.Recordset")
    RS.Open "SELECT username, password, level FROM members WHERE username LIKE" & username & ";", Conn
    If RS.EOF then 
    Response.Redirect("defualt.asp?s=badinfo")
    ELSE
    Session("username") = RS.fields.item("username")
    Session("login") = 1
    Session("level") = RS.fields.item("level")
    if Session("login") = 1 AND Session("level") >1 then
    Response.Write "Loggin in"
    Response.Redirect("home.asp")
     
    end if 
    RS.close
    set RS = nothing
    end if
    Conn.close
    set Conn = nothing
    %>
    </head>
    </html>

    i have tried it without any html or head tags, but i get the same result.

    you can go to www.dinkumrocks.com/admin and see for yourself, use test, and test for username and pass.

    thanks

  9. #9
    ok, try this and let us know what it printed on the screen

    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="standard.css">
    <%
    username = Request.Form("username")
    password = Request.Form("password")

    Set Conn = Server.CreateObject("ADODB.Connection")
    lpath = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("main.mdb")
    Conn.Open(lpath)
    set RS = Server.CreateObject("ADODB.Recordset")
    RS.Open "SELECT username, password, level FROM members WHERE username LIKE '%" & username & "%';", Conn
    If RS.EOF then
    response.write "STEP1"
    Response.Redirect("defualt.asp?s=badinfo")
    ELSE
    response.write "STEP2 "
    Session("username") = RS.fields.item("username")
    Session("login") = 1
    Session("level") = RS.fields.item("level")
    if Session("login") = 1 AND Session("level") >1 then
    Response.Write "STEP 3 "
    ' Response.Redirect("home.asp")
    else
    Response.Write "STEP 4 "
    end if
    RS.close
    set RS = nothing
    end if
    Conn.close
    set Conn = nothing
    %>
    </head>
    </html>
    now with blog, click here

  10. #10






    OK, i upoaded it to the server, and opened admin/default.asp(where you sign in). i put in my username and pass. it send the info to logincheck.asp. it just turned up a 500 error.



    then i put it in the abyss persinal web server thinger i downloaded, and i got this....





    Code:
     Microsoft OLE DB Provider for ODBC Drivers- Error '80040e14'
    
    [Microsoft][ODBC Microsoft Access Driver] The LEVEL clause includes a reserved word or argument that is misspelled or missing, or the punctuation is incorrect. /admin/logincheck.asp, line 12



    im sooooo confused.

    thanks for the help

  11. #11
    check your variables. Sounds like you mispelled it or used a reserved word for your variable. A good thing to try to do is "txt" in front of your variables if it is fed from a text field. like txtLevel. That way you prevent things like this. Could be "level" causing your problem....not sure.

    shane-c....Your site is a lot like a transvestite in that respect.
    fester8542.I'd hit it like the fist of an angry God .
    JoshuaJonah.I design for DDD. Then clients usually like it, and the ladies find me more attractive.
    Cybercode Albert Einstein Said that my math teacher has that on his wall

    K-Emmys-06: Best "Best Mod" K-Emmys-06: Best "Most Creative Critic"

    Member #1 of the "I wont critique Timmytot's designs anymore" club

  12. #12
    !!!!! it wortkds!!!!!! woooooooooooooooooooo!!!!

    it sends out step 2 and 3, which means everything is working.

    THANKS SOOOO MUCH!
    ive been spending 3 days on this hahaha.

    thank you.

  13. #13
    oh yea, one more thing..... Rab, can you explain why you put the...

    '%" & username & "%';", Conn

    '% before and after the username?

    just curious

    thanks

  14. #14
    what was the problem? Rab's code looked good to me.

    shane-c....Your site is a lot like a transvestite in that respect.
    fester8542.I'd hit it like the fist of an angry God .
    JoshuaJonah.I design for DDD. Then clients usually like it, and the ladies find me more attractive.
    Cybercode Albert Einstein Said that my math teacher has that on his wall

    K-Emmys-06: Best "Best Mod" K-Emmys-06: Best "Most Creative Critic"

    Member #1 of the "I wont critique Timmytot's designs anymore" club

  15. #15
    i know its not wrong, i just never saw the '% in hte sql string before, and i was wondering if it has a purpose for being there or something.


    thanks

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012