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 7 of 7
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Grabbing information from session

    Hello,

    I have this site to where people can get access to via a username and passwrod. THere is also a download section in here, but i want to limit the amount of downloads, but i also am covering up where the download is located. So when someone hits download on the page, they get sent to an asp page. This asp page has a response.redirect to download the file.

    I have stored the peoples username and password in a session. I can "response.write" the infromatino that is in the session, yet i can not assign that information to a variable. Any help you can provide will be appreciated:

    <%
    If Session("login") = FALSE Then
    Response.Redirect "http://www.yahoo.com"
    Else

    Dim myconn, verify, blnLoggedIn, user, pass, site, logged, objRS, exceeded
    Set verify = Server.CreateObject("ADODB.Connection")
    verify.open = (SQL LOGIN STUFF GOES HERE)

    Response.Write(Session("username"))
    Response.Write(Session("password"))

    user = Session("username")
    pass = Session("password")


    exceeded = 5

    Set objRS = myconn.execute("SELECT id, download, totaldl FROM testing WHERE username='" & user & "' AND pass='" & pass & "';")

    If objRS.EOF Then '''NO RECORDS MATCH. USER DID NOT LOG IN CORRECTLY
    blnLoggedIn = False
    Response.Redirect "http://www.yahoo.com"

    Else
    If objRS("download") >= exceeded Then 'LOGGED IN AN ABNORMAL TIME
    blnLoggedIn = false
    Response.Redirect "http://www.google.com"

    Else '''EVERYTHING PASSED PROCEEDE WITH DOWNLOAD
    blnLoggedIn = True
    verify.execute("UPDATE testing set download = (download + 1) , totaldl = (totaldl + 1) WHERE username='" & user & "' AND pass='" & pass & "';")

    End If
    End If
    End If
    %>
    <html>
    <head>
    <title>Logged</title>
    </head>
    <body>
    <%
    Response.Redirect "http://ps2.ign.com"
    %>
    </body>
    </html>
    Thanks!
    Last edited by Athmaus; 05-31-2005 at 09:00 PM.

  • #2
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,065
    Thanks
    4
    Thanked 8 Times in 8 Posts
    user = Session("username")
    pass = Session("password")
    Response.Write("session(""username"") = " & Session("username") & "<br>")
    Response.Write("user = " & user & "<br>")
    Response.Write("session(""password"") = " & Session("password")& "<br>")
    Response.Write("pass = " & pass & "<br>")

    These do not write out the same info to the screen??

  • #3
    New Coder
    Join Date
    Apr 2004
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry i forgot to put the error i am recieving:

    Microsoft VBScript runtime error '800a01a8'
    Object required: ''

    on this line: Set objRS = myconn.execute("SELECT id, download, totaldl FROM testing WHERE username='" & user & "' AND pass='" & pass & "';")


    Quote Originally Posted by miranda
    user = Session("username")
    pass = Session("password")
    Response.Write("session(""username"") = " & Session("username") & "<br>")
    Response.Write("user = " & user & "<br>")
    Response.Write("session(""password"") = " & Session("password")& "<br>")
    Response.Write("pass = " & pass & "<br>")

    These do not write out the same info to the screen??
    I do not want to response.write the info in the session, that is there to make sure that infor is being passed into the session.

    I am trying to get that info that is in the session for that query

  • #4
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,065
    Thanks
    4
    Thanked 8 Times in 8 Posts
    it isn't pointing to the variable like you said here then....
    I can "response.write" the infromatino that is in the session, yet i can not assign that information to a variable.
    The problem is you have not got the connection object opened or you used a different one from the one that you opened.
    this is your connection object as you opened it
    Set verify = Server.CreateObject("ADODB.Connection")
    verify.open = (your dsn or dsnless connection string goes here)

    then you used
    myconn.execute instead of verify.execute

  • #5
    New Coder
    Join Date
    Apr 2004
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Dude you are awesome! i totally overlooked that. Thank you sooo much, that fixed it

  • #6
    Regular Coder Freon22's Avatar
    Join Date
    May 2005
    Location
    USA
    Posts
    287
    Thanks
    3
    Thanked 5 Times in 5 Posts
    Not fast enough in my post.
    Last edited by Freon22; 05-31-2005 at 09:59 PM.

  • #7
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,065
    Thanks
    4
    Thanked 8 Times in 8 Posts
    you are welcome.


  •  

    Posting Permissions

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