[insert_php]

function getUserIP()
{
$client = @$_SERVER[‘HTTP_CLIENT_IP’];
$forward = @$_SERVER[‘HTTP_X_FORWARDED_FOR’];
$remote = $_SERVER[‘REMOTE_ADDR’];

if(filter_var($client, FILTER_VALIDATE_IP))
{
$ip = $client;
}
elseif(filter_var($forward, FILTER_VALIDATE_IP))
{
$ip = $forward;
}
else
{
$ip = $remote;
}

return $ip;
}

$user_ip = getUserIP();

echo $user_ip.”   “; // Output IP address [Ex: 177.87.193.134]

$astring = str_replace(“.”,”,”,$user_ip);

$intg = array_map(‘intval’, explode(‘,’, $astring));

echo “\n\n”.”This is your voting number:   “. array_sum($intg).” – “;

//Get current time timestamp
$time_now = time();

//Create DateTime class object
$date = new DateTime();

//Set timestamp to DateTime object
$date->setTimestamp( $time_now );

//Set timezone so that code don’t get server’s timezone midnight time
$date->setTimezone(new DateTimeZone(‘Europe/Dublin’));

//Print current time in user’s timezone
//echo $date->format(‘Y-m-d H:i’) . “
“;

//Get time stamp for midnight tonight
$date->modify(‘today midnight’);
$midnight_time = $date->getTimestamp();

//Print midnight time in user’s timezone
//echo $date->format(‘Y-m-d H:i’) . “
“;

//Now you will need to subtract midnight time from current time in user’s timezone
$seconds_since_midnight = $time_now – $midnight_time;

echo date(‘y’, strtotime(‘-2000 year’));
echo date(‘m’, strtotime(‘-0 month’));
echo date(‘d’, strtotime(‘-0 day’));
//Print seconds since midnight in your timezone
echo $seconds_since_midnight;

[/insert_php]

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

Log in with your credentials

Forgot your details?

Proudly powered by WordPress and BuddyPress | Terms | Privacy   -  Copyright © 2012 - 2023     Ballynagran Energy Plus  and  The Owner  -   All Rights Reserved.