cordoprod Posted November 9, 2008 Share Posted November 9, 2008 Hello. I want to display a welcome message when a user logs in. Here is my code: function welcome($timestamp) { $time = time(); if($timestamp-$time > 0 and $timestamp-$time < 86400) { return "Nice too see you again so soon."; } elseif($timestamp-$time > 86400 and $timestamp-$time < 604800) { return "Nice too see you, it's been a short while."; } elseif($timestamp-$time > 604800 and $timestamp-$time < 2629743.83) { return "Nice too see you again. It's been a long time."; } elseif($timestamp-$time > 2629743.83 and $timestamp-$time < 31556926) { return "I am glad too see you active. Long time no see......."; } else { return "Wow, you're online. It's been over a year!"; } } I have a timestamp (generated from time() and the rest is pretty obvious i guess. The cases are a day, a week, a month, a year, and so on. :-) Link to comment https://forums.phpfreaks.com/topic/132022-solved-generate-welcome-message/ Share on other sites More sharing options...
thecard Posted November 9, 2008 Share Posted November 9, 2008 What can't you do? Link to comment https://forums.phpfreaks.com/topic/132022-solved-generate-welcome-message/#findComment-686016 Share on other sites More sharing options...
runnerjp Posted November 9, 2008 Share Posted November 9, 2008 whats wrong with it? Link to comment https://forums.phpfreaks.com/topic/132022-solved-generate-welcome-message/#findComment-686018 Share on other sites More sharing options...
Imad Posted November 9, 2008 Share Posted November 9, 2008 I don't see anything wrong with it? Link to comment https://forums.phpfreaks.com/topic/132022-solved-generate-welcome-message/#findComment-686026 Share on other sites More sharing options...
cordoprod Posted November 9, 2008 Author Share Posted November 9, 2008 I figured it out myself i obviously had to switch around the > and <. Link to comment https://forums.phpfreaks.com/topic/132022-solved-generate-welcome-message/#findComment-686033 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.