Web Design and Development Forums

[SOLVED] Your last visit is Today??

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


Go Back   Webforumz.com > Program Your Website > ASP Forum

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Oct 23rd, 2007, 09:04   #1 (permalink)
Most Reputable Member
 
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
Blog Entries: 2
Send a message via Yahoo to Monie
[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)
__________________

Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 23rd, 2007, 09:29   #2 (permalink)
 
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,750
Send a message via MSN to Marc Send a message via Skype™ to Marc
Re: Your last visit is Today??

It will be a little IF function... I guess but i am no PHP expert
__________________
I'm back!!!!
Marc is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 23rd, 2007, 12:28   #3 (permalink)
Elite Veteran
 
karinne's Avatar
 
Join Date: Jan 2007
Location: You know where
Age: 30
Posts: 4,883
Re: Your last visit is Today??

Yeah ... I would use a simple IF function that IF the date is today, then display Today.
__________________
a web design portfolio | web non-sense
karinne is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 23rd, 2007, 16:18   #4 (permalink)
Administrator
 
alexgeek's Avatar
 
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 4,102
Blog Entries: 9
Send a message via MSN to alexgeek
Re: Your last visit is Today??

PHP-section?

If you have any code I might be able to edit it for you.
__________________
Languages: PHP, mySQL (queries), C#, (X)html, CSS, JS.


alexgeek is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 23rd, 2007, 16:32   #5 (permalink)
Elite Veteran
 
karinne's Avatar
 
Join Date: Jan 2007
Location: You know where
Age: 30
Posts: 4,883
Re: Your last visit is Today??

monie usually posts in the ASP section ... but he didn't specify so I left it here.
__________________
a web design portfolio | web non-sense
karinne is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 23rd, 2007, 18:34   #6 (permalink)
 
AdRock's Avatar
 
Join Date: Jul 2006
Location: Devon, England
Posts: 567
Send a message via MSN to AdRock
Re: Your last visit is Today??

Surely a cookie must be set so it knows when you last logged in
__________________
If your thread has been resolved, please use Thread Tools and mark the thread as Topic Solved. This saves us time looking at threads that are already solved
AdRock is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 23rd, 2007, 18:49   #7 (permalink)
 
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,750
Send a message via MSN to Marc Send a message via Skype™ to Marc
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....
__________________
I'm back!!!!
Marc is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 23rd, 2007, 19:17   #8 (permalink)
 
AdRock's Avatar
 
Join Date: Jul 2006
Location: Devon, England
Posts: 567
Send a message via MSN to AdRock
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
__________________
If your thread has been resolved, please use Thread Tools and mark the thread as Topic Solved. This saves us time looking at threads that are already solved
AdRock is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 23rd, 2007, 19:23   #9 (permalink)
 
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,750
Send a message via MSN to Marc Send a message via Skype™ to Marc
Re: Your last visit is Today??

It would then probubly use a Cookie... No, not a chocolate chip one
__________________
I'm back!!!!
Marc is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 24th, 2007, 00:18   #10 (permalink)
Elite Veteran
 
Daniel's Avatar
 
Join Date: Sep 2006
Location: The Kingdom of Rabbits
Age: 21
Posts: 2,381
Blog Entries: 12
Send a message via MSN to Daniel
Re: Your last visit is Today??

Its a bit of php script that uses the server calendar to determine what day it is.
__________________
FMFA Manager / World Footy Forums
Daniel is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 24th, 2007, 01:42   #11 (permalink)
Most Reputable Member
 
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
Blog Entries: 2
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 ")%>
__________________

Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 24th, 2007, 13:32   #12 (permalink)
Elite Veteran
 
karinne's Avatar
 
Join Date: Jan 2007
Location: You know where
Age: 30
Posts: 4,883
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!
__________________
a web design portfolio | web non-sense
karinne is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 25th, 2007, 02:02   #13 (permalink)
Most Reputable Member
 
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
Blog Entries: 2
Send a message via Yahoo to Monie
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..
__________________

Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 25th, 2007, 07:08   #14 (permalink)
Administrator
 
alexgeek's Avatar
 
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 4,102
Blog Entries: 9
Send a message via MSN to alexgeek
Re: Your last visit is Today??

Jacob's thread.
__________________
Languages: PHP, mySQL (queries), C#, (X)html, CSS, JS.


alexgeek is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 25th, 2007, 07:30   #15 (permalink)
Most Reputable Member
 
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
Blog Entries: 2
Send a message via Yahoo to Monie
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....
__________________

Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 25th, 2007, 09:10   #16 (permalink)
 
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,750
Send a message via MSN to Marc Send a message via Skype™ to Marc
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
__________________
I'm back!!!!
Marc is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 25th, 2007, 09:25   #17 (permalink)
Most Reputable Member
 
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
Blog Entries: 2
Send a message via Yahoo to Monie
Re: Your last visit is Today??

Quote:
Originally Posted by Marc