Skip to content

Instantly share code, notes, and snippets.

nicolassaad / ajax-greeting.php
Last active Sep 23, 2020
Timely Greeting (2.0.1) A PHP script that you can use on your site to automatically display a greeting based on what time of day it is for the user. TO USE: See Readme.txt file
View ajax-greeting.php
// Handle AJAX request
if( isset($_POST['value']) ){
// Storing the timezone offset from the jQuery code
$timezone_offset_minutes = $_POST['value'];
// Convert minutes to seconds
$timezone_name = timezone_name_from_abbr("", ($timezone_offset_minutes*60), false);
//JS code is needed to retrieve the user's timezone dynamically so we have it set statically for now