[SOLVED] Your last visit is Today??

This is a discussion on "[SOLVED] Your last visit is Today??" within the Classic ASP section. This forum, and the thread "[SOLVED] Your last visit is Today?? are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Oct 23rd, 2007, 09:04
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
[SOLVED] Your last visit is Today??

Just wondering how to do that?
Instead of displaying today's date, it display "Today".

Thanks..
Attached Images
File Type: png Last Visit.png (2.0 KB, 46 views)
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Oct 23rd, 2007, 09:29
Marc's Avatar
Staff Manager

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Posts: 1,780
Thanks: 0
Thanked 16 Times in 16 Posts
Re: Your last visit is Today??

It will be a little IF function... I guess but i am no PHP expert
__________________
Marc
Staff Manager - Webforumz.com


Want to be a moderator? PM me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Oct 23rd, 2007, 12:28
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Your last visit is Today??

Yeah ... I would use a simple IF function that IF the date is today, then display Today.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Oct 23rd, 2007, 16:18
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Your last visit is Today??

PHP-section?

If you have any code I might be able to edit it for you.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Oct 23rd, 2007, 16:32
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Your last visit is Today??

monie usually posts in the ASP section ... but he didn't specify so I left it here.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Oct 23rd, 2007, 18:34
Highly Reputable Member
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Your last visit is Today??

Surely a cookie must be set so it knows when you last logged in
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Oct 23rd, 2007, 18:49
Marc's Avatar
Staff Manager

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Posts: 1,780
Thanks: 0
Thanked 16 Times in 16 Posts
Re: Your last visit is Today??

Quote:
Originally Posted by AdRock View Post
Surely a cookie must be set so it knows when you last logged in
By my reckoning monie never asked how the login works.. He asks how it displays today instead of the date.... Thus uses an IF function....
__________________
Marc
Staff Manager - Webforumz.com


Want to be a moderator? PM me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Oct 23rd, 2007, 19:17
Highly Reputable Member
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Your last visit is Today??

Quote:
Originally Posted by Marc View Post
By my reckoning monie never asked how the login works.. He asks how it displays today instead of the date.... Thus uses an IF function....
Ahh...i see

I was just thinking if you hadn't logged for a few days, how it knows when you last logged in
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Oct 23rd, 2007, 19:23
Marc's Avatar
Staff Manager

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Posts: 1,780
Thanks: 0
Thanked 16 Times in 16 Posts
Re: Your last visit is Today??

It would then probubly use a Cookie... No, not a chocolate chip one
__________________
Marc
Staff Manager - Webforumz.com


Want to be a moderator? PM me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Oct 24th, 2007, 00:18
Daniel's Avatar
Elite Veteran
Join Date: Sep 2006
Location: The Kingdom of Rabbits
Age: 21
Posts: 2,051
Blog Entries: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Your last visit is Today??

Its a bit of php script that uses the server calendar to determine what day it is.
Last Blog Entry: Assassin's Creed (Nov 22nd, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Oct 24th, 2007, 01:42
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
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 ")%>
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Oct 24th, 2007, 13:32
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Your last visit is Today??

Quote:
Originally Posted by monie View Post
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.
Oh yes I notice This is my zoo after all ... apparently!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Oct 25th, 2007, 02:02
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Your last visit is Today??

Quote:
Originally Posted by karinne View Post
Oh yes I notice This is my zoo after all ... apparently!
yeah, I heard you say that before! I can't remember where? lol..
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old Oct 25th, 2007, 07:08
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Your last visit is Today??

Jacob's thread.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old Oct 25th, 2007, 07:30
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Your last visit is Today??

Quote:
Originally Posted by alexgeek View Post
Jacob's thread.
Ohh yeah...

Ok back to topic guys..

Quote:
Originally Posted by karinne View Post
Yeah ... I would use a simple IF function that IF the date is today, then display Today.
How does we make the checking as karinne suggest. Obviously, in my example, we have to query the "lastactivedate" from my database and make comparison to the current date. I don't get the picture how to do that?

Hemmm....
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16  
Old Oct 25th, 2007, 09:10
Marc's Avatar
Staff Manager

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Posts: 1,780
Thanks: 0
Thanked 16 Times in 16 Posts
Re: Your last visit is Today??

This is PHP but it will maybey give you the layout!! I am no expert!! (I know you want it in ASP but it might give you a rough way how to do it!)

PHP: Select all


if($row['lastvisited'] == $todays_date) {
// The person did visit today
echo "Your last visit was Today - Welcome!";

} else {
// The person never visited today
echo "Your last visit was" $row['lastvisited'];

Please bear in mind this is the way i would do it in PHP so it probubly isnt right!!

Also i havent included the select statement - you probubly know how to do it.....

Ignore $row['lastvisited'] - that would be the way i was doing it if i was using PHP - instead use your variable for getting the date from the database.

Hope that helps bearing in mind i done it in PHP - not ASP
__________________
Marc
Staff Manager - Webforumz.com


Want to be a moderator? PM me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #17  
Old Oct 25th, 2007, 09:25
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Your last visit is Today??

Quote:
Originally Posted by Marc View Post
This is PHP but it will maybey give you the layout!! I am no expert!! (I know you want it in ASP but it might give you a rough way how to do it!)

Please bear in mind this is the way i would do it in PHP so it probubly isnt right!!

Also i havent included the select statement - you probubly know how to do it.....

Ignore $row['lastvisited'] - that would be the way i was doing it if i was using PHP - instead use your variable for getting the date from the database.

Hope that helps bearing in mind i done it in PHP - not ASP
Relax Marc, I understand a little bit of PHP as I am learning them if I have a free time. I do understand your code there 100%, but...
it only check