| Welcome to Webforumz.com. |
|
Oct 23rd, 2007, 09:04
|
#1 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
[SOLVED] Your last visit is Today??
Just wondering how to do that?
Instead of displaying today's date, it display "Today".
Thanks..
__________________
|
|
|
Oct 23rd, 2007, 09:29
|
#2 (permalink)
|
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,750
|
Re: Your last visit is Today??
It will be a little IF function... I guess but i am no PHP expert 
__________________
I'm back!!!! 
|
|
|
Oct 23rd, 2007, 12:28
|
#3 (permalink)
|
|
Elite Veteran
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.
|
|
|
Oct 23rd, 2007, 16:18
|
#4 (permalink)
|
|
Administrator
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 4,102
|
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.
|
|
|
Oct 23rd, 2007, 16:32
|
#5 (permalink)
|
|
Elite Veteran
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.
|
|
|
Oct 23rd, 2007, 18:34
|
#6 (permalink)
|
Join Date: Jul 2006
Location: Devon, England
Posts: 567
|
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
|
|
|
Oct 23rd, 2007, 18:49
|
#7 (permalink)
|
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,750
|
Re: Your last visit is Today??
Quote:
Originally Posted by AdRock
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!!!! 
|
|
|
Oct 23rd, 2007, 19:17
|
#8 (permalink)
|
Join Date: Jul 2006
Location: Devon, England
Posts: 567
|
Re: Your last visit is Today??
Quote:
Originally Posted by Marc
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
|
|
|
Oct 23rd, 2007, 19:23
|
#9 (permalink)
|
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,750
|
Re: Your last visit is Today??
It would then probubly use a Cookie... No, not a chocolate chip one 
__________________
I'm back!!!! 
|
|
|
Oct 24th, 2007, 00:18
|
#10 (permalink)
|
|
Elite Veteran
Join Date: Sep 2006
Location: The Kingdom of Rabbits
Age: 21
Posts: 2,381
|
Re: Your last visit is Today??
Its a bit of php script that uses the server calendar to determine what day it is.
|
|
|
Oct 24th, 2007, 01:42
|
#11 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: Your last visit is Today??
Quote:
Originally Posted by alexgeek
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
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
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 ")%>
__________________
|
|
|
Oct 24th, 2007, 13:32
|
#12 (permalink)
|
|
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 30
Posts: 4,883
|
Re: Your last visit is Today??
Quote:
Originally Posted by monie
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! 
|
|
|
Oct 25th, 2007, 02:02
|
#13 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: Your last visit is Today??
Quote:
Originally Posted by karinne
Oh yes I notice  This is my zoo after all ... apparently! 
|
yeah, I heard you say that before! I can't remember where? lol..
__________________
|
|
|
Oct 25th, 2007, 07:08
|
#14 (permalink)
|
|
Administrator
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 4,102
|
Re: Your last visit is Today??
Jacob's thread.
__________________
Languages: PHP, mySQL (queries), C#, (X)html, CSS, JS.
|
|
|
Oct 25th, 2007, 07:30
|
#15 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: Your last visit is Today??
Quote:
Originally Posted by alexgeek
Jacob's thread.
|
Ohh yeah...
Ok back to topic guys..
Quote:
Originally Posted by karinne
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....
__________________
|
|
|
Oct 25th, 2007, 09:10
|
#16 (permalink)
|
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,750
|
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!!!! 
|
|
|
Oct 25th, 2007, 09:25
|
#17 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: Your last visit is Today??
Quote:
Originally Posted by Marc
| | | | |