stuck again

Results 1 to 2 of 2

Thread: stuck again

  1. #1
    seko Guest

    Default stuck again

    I am trying to use session variable for login and password protection page my page works that it matches the userid and password from the table and then allow access how can I do it ...and how can I prevent users to go directly from diff. page sof the website without entering passowrd...<BR>any help will be great<BR>thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: stuck again

    Set up a login page with a form for UserName and ID and have it submit to a welcome page or any page in your web.<BR><BR>Assuming you store the usernames and ID&#039;s in a db. Do this:<BR><BR>Create this page and name it whatever you like changing the variables to match your info:<BR><BR>&#060;%<BR>dim conn<BR>dim strconn<BR><BR><BR><BR>strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("yourdb.mdb")<BR><BR>set conn = server.createobject("adodb.connection")<BR>conn.op en strconn<BR><BR>Username = Request("Username")<BR>Password = Request("Password")<BR><BR>SQL = "SELECT * FROM yourtable WHERE UserName = &#039;" & Username & "&#039; AND Password =&#039;" & Password & "&#039;"<BR>set oRs = conn.Execute(SQL)<BR>If oRs.EOF Then<BR>Response.Redirect("sorry.asp") &#039;you will need to create this page<BR>Else<BR>Session("id") = oRs("ID")<BR>End If<BR>Set conn = Nothing<BR><BR><BR>%&#062;<BR><BR>Then put this statement at the top of every page in your web:<BR><BR>&#060;%<BR>if session("ID") = "" then <BR>response.redirect("sorry.asp") <BR>end if<BR>%&#062;<BR><BR>Hope that helps<BR><BR><BR>

Posting Permissions

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