<?php
//get the values we need to log into the mySQL server with
include 'core/config/config.inc.php';
//php date
$arr['php'] = date("F j, Y, g:i a");
//mysql
$link = mysql_connect($database_server, $database_user, $database_password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
if (!mysql_select_db($dbase)) {
die('Could not select database: ' . mysql_error());
}
//get the mySQL time
$result = mysql_query("SELECT NOW();");
if (!$result) {
die('Could not query:' . mysql_error());
}
$arr['time'] = mysql_fetch_array($result);
//returns the system timezone.
$result = mysql_query("SELECT @@system_time_zone;");
if (!$result) {
die('Could not query:' . mysql_error());
}
$arr['systimezone'] = mysql_fetch_array($result);
//returns the session timezone if it differs from the system timezone.
$result = mysql_query("SELECT IF(@@session.time_zone = 'SYSTEM', @@system_time_zone, @@session.time_zone);");
if (!$result) {
die('Could not query:' . mysql_error());
}
$arr['sestimezone'] = mysql_fetch_array($result);
mysql_close($link);
$times = 'php time is: '.$arr['php'].'
';
$times .= 'mySQL time is: '.$arr['time'][0].'
';
$times .= 'mySQL system timezone is: '.$arr['systimezone'][0].'
';
$times .= 'mySQL session timezone is: '.$arr['sestimezone'][0].'
';
return $times;php time is: June 26, 2012, 11:43 pm
mySQL time is: 2012-06-26 23:43:28
mySQL system timezone is: BST
mySQL session timezone is: BST
Forbidden(I just saved it as a php file).
You do not have permission to access this document.
Name: modx_remember_manager
Value: admin
Expires: Sun, 07 Dec 1969 03:28:36 GMT
Name: SN4fe61ad9*****
Value: h3896d0ukbom5gvnfm********
Expires: Sun, 07 Dec 1969 03:28:36 GMT
Name: modx_remember_managerTaking into account current Summer Time, the first time is correct, if it is supposed to represent login time, but just a year too far ahead. The second is the correct time but a week ahead.
Value: admin
Expires: Mon, 01 Jul 2013 08:01:42 GMT
Name: SN4fe61ad9*****
Value: h3896d0ukbom5gvnfm********
Expires: Sun, 08 Jul 2012 08:02:44 GMT