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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ASP Log off script

    Hi there

    Could someone please give ma a log off script in asp. The logon section of the script is below:

    <%
    dim db
    set db = Server.CreateObject("ADODB.Connection")
    db.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("project.mdb")
    dim strEmail, strPassword
    strUsername = Request("username")
    strPassword = Request("Password")

    dim rsUsers
    dim sql
    set rsUsers = Server.CreateObject("ADODB.Recordset")
    sql = "SELECT * FROM tblmember WHERE username = '" & strUsername & "';"
    rsUsers.Open sql, db

    if not rsUsers.EOF then 'User was found - check password
    if UCase(rsUsers("Password")) = UCase(strPassword) then
    dim strName, value
    for each sField in rsUsers.Fields
    strName = sField.Name
    value = sField.value
    next

    session("username")=request("username")
    Session("UserLoggedIn") = True

    'redirect the user to the "validated" page
    Response.Redirect "validated.asp"
    else

    Session("username") = Request("username")
    Response.Redirect "validate.asp?Again=1&BadPW=True"
    end if
    else
    Session("username") = Request("username")
    if Request("Again") = "1" then
    Response.Redirect "validate.asp?Again=1"
    else
    response.redirect "validate.asp?Again=1"
    end if
    end if

    %>


    Many thanks in advance!!

    Darren

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Session.Abandon
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    really you should use cookies as they are much better for the server than sessions, these should probably be added to things like the data in a certain format in a single string and encrypted before sending them to the client (as the client can read them in firefox, notepad or whatever)

  • #4
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for that

    EDIT: Problem fixed
    Last edited by techno_monkey; 01-12-2005 at 06:34 PM. Reason: Fixed


  •  

    Posting Permissions

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