Results 1 to 2 of 2

Thread: login

  1. #1
    Join Date
    Dec 1969

    Default login

    I&#039;m trying to make a script that allows the user to login using sessions, once they login the first time it saves a session for 4 hours that allows them to skip the login during that period.<BR>The proble is the following is not taking them to the storelogin.asp page if they dont have an active session, if they do have a session this script seams to work fine!<BR><BR><BR><BR><BR>&#060;%<BR>If Session("store") = true then<BR>user = Session("store")<BR>Else<BR>Response.Redirect ("storelogin.asp")<BR>End if<BR>%&#062;<BR>&#060;%<BR>Set MyConn = Server.CreateObject("ADODB.Connection")<BR>MdbFile Path = Server.MapPath("/db/test.mdb")<BR>MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"<BR>SQL_query="SELECT * FROM tbltest WHERE user = &#039;"&user & "&#039;"<BR>Set RSlogin = MyConn.Execute(SQL_query)<BR>If RSLogin.EOF then <BR> Response.Redirect ("storelogin.asp?name=" & Request.Form("name") & "&id=" & Request.Form("id") & "&price=" & Request.Form("price") & "&brand=" & Request.Form("brand") & "&product=" & Request.Form("product") & "&msg=" & Server.URLEncode("Incorrect username and password")) <BR>End if <BR>%&#062;<BR>&#060;%<BR>If Session("pass") = RSlogin("pass") then<BR>Response.Redirect ("updateprice.asp?name=" & Request.QueryString("name") & "&id=" & Request.QueryString("id") & "&price=" & Request.QueryString("price") & "&brand=" & Request.QueryString("brand") & "&product=" & Request.QueryString("product"))<BR>Else<BR>Respons e.Redirect ("storelogin.asp")<BR>End if<BR>%&#062;

  2. #2
    Dynamic Guest

    Default RE: login

    Your problem is when the last browser window is closed, your session is destroyed. I recommend you look into the Response.Cookies collection. This way you can set a cookie to expire in 4 hours. When a user returns to your site you can check for the cookie. If it exsists, you can pull the login information from there.

Posting Permissions

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