Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Adding last login date/time stamp

Guest
Apr 29, 2007 Apr 29, 2007

Copy link to clipboard

Copied

Hi,

I'm developing ASP pages MX2004 using an MS Access db and want to record the date/time of last login. I've used DW's built-in user authentication script successfully but can't figure out how to add this piece. I tried using the "update record" server behavior but that hasn't worked. I get the little "!" symbol next to the item in the server behavior window even before I test it.

I'm pretty much a novice but I have successfully used this element (the insert/update date/time stamp) when writing a record to the db from a form. It's adding this piece to the login step that I can't figure out.

Any ideas? I appreciate the help.
TOPICS
Server side applications

Views

490
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 30, 2007 Apr 30, 2007

Copy link to clipboard

Copied

The simplest way to do this is the following

Create a new page
Create a recordset looking at your members table and filtering passed on a
session variable called "MM_UserName" which is created with the standard
logoin behaviour
Create a form on the page and place two hidden fields on it. Match the names
of the field with the ID & Date fields in your database.
Map your recordset to the ID field and in the date field enter <#=now()#> as
the value.
Now place an update behaviour on the page, which the redirection going to
the page that you currently go to after a successful login.
Edit the script to remove any references to it needing a submit button in an
IF statement.

Now go back to your original login script and change the redirect to the
page you have just created.

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"NewDevGuy" <webforumsuser@macromedia.com> wrote in message
news:f12u8m$dtg$1@forums.macromedia.com...
> Hi,
>
> I'm developing ASP pages MX2004 using an MS Access db and want to record
> the
> date/time of last login. I've used DW's built-in user authentication
> script
> successfully but can't figure out how to add this piece. I tried using
> the
> "update record" server behavior but that hasn't worked. I get the little
> "!"
> symbol next to the item in the server behavior window even before I test
> it.
>
> I'm pretty much a novice but I have successfully used this element (the
> insert/update date/time stamp) when writing a record to the db from a
> form.
> It's adding this piece to the login step that I can't figure out.
>
> Any ideas? I appreciate the help.
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 03, 2007 May 03, 2007

Copy link to clipboard

Copied

very easy to do. just in case that sounded like complete greek to you, I'll help put it into terms a beginner would understand.

You can create a second page that actually compares users against the DB, and on that page adds an update to the recordset if that recordset is found (i.e. looks for matching username and password, and if found updates a field in the table that you will create that you will call lastlogin or similar), and then redirects to protected area. If the username and password is not found, redirects to your login err message indicating it's not a found login.

On the login form:
<form name="form1" method="post" action="thepagethathasthescript.asp">

On the script page, it will look something close to this:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="connections/yourconnectionname.asp" -->

<%
dim username, password
username = session("username")
password = session("password")

set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_yourconnectionname_STRING
rs.Source = "SELECT * FROM Table WHERE username = '" + Replace(username, "'", "''") + "'" & "AND Password = '" + Replace(password, "'", "''") + "'"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 3
rs.Open()
rs_numRows = 0

if rs.eof or rs.bof then
response.redirect "login.asp?err=true"
else

rs("LastLogin") = date()
rs.Update

response.redirect "secureareatheyaregoing.asp"

end if
%>
<%
rs.Close()
%>

code is not tested, but what do you want at 1AM off the top of my head. that should at least give you a good head start. If you would like us to do any work for you, you can also hire our design firm. Check the link below.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 04, 2007 May 04, 2007

Copy link to clipboard

Copied

LATEST
Thanks for the replied everyone. I very much appreciate the help I get on this board.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines