View Single Post
  #11 (permalink)  
Old Oct 24th, 2007, 01:42
Monie Monie is offline
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: Your last visit is Today??

Quote:
Originally Posted by alexgeek View Post
PHP-section?

If you have any code I might be able to edit it for you.
I can smell php code alex... but I prefer ASP
I think, either way, the solution would be almost similar, right?

Quote:
Originally Posted by karinne View Post
monie usually posts in the ASP section ... but he didn't specify so I left it here.
Ahh... you notice that
It's because I don't know if this is done with asp or javascript or maybe php. So I post it here. Could you move this thread to the ASP section karinne, thanks.

Quote:
Originally Posted by AdRock View Post
Ahh...i see

I was just thinking if you hadn't logged for a few days, how it knows when you last logged in
I use an update statement that capture todays date and time and update them in the database once the user log off..

Logout page:
Code: Select all
<%
    dim dd, mm, yyyy, newtime, newdate
        dd=day(date)
    if len(dd)=1 then
        dd="0" & dd
    end if
        mm=month(date)
    if len(mm)=1 then
        mm="0" & mm
    end if
        yyyy=year(date)
    
    'getting new date
    newdate = dd & "-" & mm & "-" & yyyy
    newtime = time()
%>
<%
Dim connectionString, rs, conn, user
user = Session("name")
    
connectionString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=monieweb; UID=root;PASSWORD=monie;"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open(connectionString)
Set rs = conn.Execute("UPDATE userlogin SET status = 'Offline', lastactivedate = '" & newdate & "', lastactivetime = '" & newtime & "' WHERE username =  '" & user & "'")

Session.Abandon
Response.Redirect("default.asp")
%>
Greeting Page:
Code: Select all
Welcome <%=rs("fullname")%>! Your last visit here is <%=rs("lastactivedate ")%> at <%=rs("lastactivetime ")%>
Reply With Quote