General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 17th, 2003, 05:24 PM
infamous-online infamous-online is offline
Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 404 infamous-online User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 24 m 44 sec
Reputation Power: 7
Remembering Last Visits

PHP Code:
<? 
//script to determine your last visit to my site 
if (isset($_COOKIE['last_visited'])) { 
    
$last $_COOKIE['last_visited']; 
    if (
date('z') == date('z'$last)) { 
        
$lastVisitStr 'You last visited ' date('Today, h:i:s A '$last); 
    } else { 
        
$lastVisitStr 'You last visited ' .  date('l, j. F'$last); 
    } 
} else { 
    
$lastVisitStr 'Welcome, This is your first visit'

setcookie('last_visited'time(), time() + 3600 24 365); 
?> 

<? 
// later on in your script you can echo $lastVisitStr 

echo $lastVisitStr 

?>



ok i got the script working, it remembers when you were last at the site and all, but now i want to make the script better but i don't know how.

ok i want it to remember the date you were last there like this you were here last here at the particular month followed by the date and then the year, and i would like to have the time part of this script removed unless it be turned into military time.

so can someone help me out here
__________________
Apache Expert

Reply With Quote
  #2  
Old December 17th, 2003, 08:19 PM
Mike_r Mike_r is offline
ExoCrew
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 68 Mike_r User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Thats pretty simple , change:
$lastVisitStr = 'You last visited ' . date('Today, h:i:s A ', $last);

To:

$lastVisitStr = 'You last visited ' . date('d-m-y', $last);

ex. Out put : "You last visited 24-12-2003"

d - Day in numbers
m - Month in numbers
y - Year in numbers

You can find more information in the Date and time at php.net documentation ..

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Remembering Last Visits


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT