troubleshooting Question

Tracking logged in users

Avatar of citrixz
citrixz asked on
ASP
19 Comments1 Solution389 ViewsLast Modified:
Hello Experts,

I have a simple logon form that authenticates username and password from an access database.  Users are also able to save there logon credentials for the next time they visit so they don't have to re-enter.  This all works fine.

I need to track what pages the logged in users are going to and have it logged.  I am a complete newb when it comes to programming and would appreciate the help.  Posted below is the code (I didn't write).

Thank you, I appreciate your time.

<% @language="vbscript" %>
<!--#include virtual="/_private/logon.inc"-->
<html>
<head><title>Logon Page</title>
<style>
body  { font-family: arial, helvetica }
table { background-color: #cccccc; font-size: 9pt; padding: 3px }
td    { color: #000000; background-color: #cccccc; border-width: 0px }
th    { color: #ffffff; background-color: #0000cc; border-width: 0px }
</style>
<meta name="Microsoft Border" content="none">
</head>
<body bgcolor="#FFFFFF">
<%
  ' Was this page posted to?
  If UCase(Request.ServerVariables("HTTP_METHOD")) = "POST" Then
    ' If so, check the username/password that was entered.
    If ComparePassword(Request("uid"),Request("pwd")) Then
      ' If comparison was good, store the user name...
      Session("uid") = Request("uid")

     if Request.Form("cbrem")="on" then 'Remember me flag is ON: storing UID and PWD in cookies
      Response.Cookies("jsfpl")("1") = Request("uid")
      Response.Cookies("jsfpl")("2") = Request("pwd")
      Response.Cookies("jsfpl").Expires = Now+30 ' Cookie keep time in days: here is 30 days from present

     else 'Erase Cookie if flag is not set
      Response.Cookies("jsfpl")("1") = ""
      Response.Cookies("jsfpl")("2") = ""
      Response.Cookies("jsfpl").Expires = Now-1
     end if

  on error resume next
     ' ...and redirect back to the original page.
     Response.Redirect Session("REFERRER")
  if err then
   response.write "<br>Error is: " & Err.Description
   response.write "<br>Uid is: " & Session("UID")
   response.write "<br>Ref is: " & Session("REFERRER")
  End if

   End If
  End If

'If this page is not posted then run code below:
Dim User,Pass,chb
User="" & Request.Cookies("jsfpl")("1")
Pass="" & Request.Cookies("jsfpl")("2")
if Not( User="" and Pass="") then
chb="checked"
end if
%>


<div align="center"><center>
<form action="<%=LOGON_PAGE%>" method="POST">
<table border="2" cellpadding="2" cellspacing="2">
  <tr>
    <th colspan="4" align="left">Enter User Name and Password</th>
  </tr>
  <tr>
    <td>&#xa0;</td>
    <td colspan="2" align="left">Please type your user name and password.</td>
    <td>&#xa0;</td>
  </tr>
  <tr>
    <td>&#xa0;</td>
    <td align="left">Site</td>
    <td align="left"><%=Request.ServerVariables("SERVER_NAME") %> &#xa0;</td>
    <td>&#xa0;</td>
  </tr>
  <tr>
    <td>&#xa0;</td>
    <td align="left">User Name</td>
    <td align="left"><input name="uid" type="text" size="20" Value="<%=User%>"></td>
    <td>&#xa0;</td>
  </tr>
  <tr>
    <td>&#xa0;</td>
    <td align="left">Password</td>
    <td align="left"><input name="pwd" type="password" size="20" Value="<%=Pass%>"></td>
    <td>&#xa0;</td>
  </tr>
  <tr>
    <td>&#xa0;</td>
    <td align="left"><input type="checkbox" name="cbrem" <%=chb%>>Remember me</td>
    <td align="center"><input type="submit" value="LOGON"></td>
    <td>&#xa0;</td>
  </tr>

<%If chb<>"" then %>
  <tr>
    <td>&#xa0;</td>
    <td colspan="2" align="left">
      Uncheck the flag to erase stored User Name and Password</td>
    <td>&#xa0;</td>
  </tr>
<%End If%>
</table> < style> body { font-family: arial, helvetica } table { background-color: #cccccc; font-size: 9pt; padding: 3px } td { color: #000000; background-color: #cccccc; border-width: 0px } th { color: #ffffff; background-color: #0000cc; border-width: 0px } < content=none name="Microsoft Border">
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 19 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 19 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros