How can I get php coding of good morning/good evening script when a user enter the site then it is show greeting.
| SitePoint Sponsor |
How can I get php coding of good morning/good evening script when a user enter the site then it is show greeting.
Last edited by ralph.m; Jan 28, 2013 at 01:08. Reason: removed link
A very simple solution, but a solution nonetheless. Take into account the different time zones of people around the world though. You might be looking for a more advanced solution if you want to change the timezone for each user, but this will give you an idea.
Code:<?php function greeting(){ $timeOfDay = date('a'); if($timeOfDay == 'am'){ return 'Good morning, welcome to our site'; }else{ return 'Good afternoon, welcome to our site'; } } echo $timeOfDay; ?>

Like bit10101 says, do you want to say "Good morning" depending on where the server is or where the user is?
This tut might help you grapple with some of the issues: http://www.onlineaspect.com/2007/06/...th-javascript/

I'm always a sucker for GeoIP: http://php.net/manual/en/book.geoip.php
<?php//Kyle Wolfeecho devBlog("My Dev Notes");




GeoIP won't be as accurate as javascript which uses the user's system clock and seems like overkill for this!

<?php//Kyle Wolfeecho devBlog("My Dev Notes");

On my shared server, geoIP functions don't work, presumably they need activating somewhere, but I don't have that kind of access. So, I would be restricted to javascript, in which case this might be helpful:
HTML Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1250"> <title></title> <script> function getTime() { var dd = new Date(); var hh = dd.getHours(); if(hh > 11){ document.write("Good afternoon"); }else{ document.write("Good morning"); } } </script> </head> <body> <p><button onclick ="getTime()">Click for greeting based on time of local machine</button></p> </body> </html>
Detect file changes remotely. SimpleSiteAudit is an early
warning anti-hacker system which sends an alert on detection.
PHP Find Orphan Files - Finds all the unreferenced files on your site.

<?php//Kyle Wolfeecho devBlog("My Dev Notes");
Bookmarks