Código fuente de 'Diferencia horaria servidor.php'
<html>
<head>
<title>Diferencia hora servidor</title>
</head>
<body style="font-family: Arial; font-size: 9pt">
<center><b><font face="Arial" size="3">Diferencia hora servidor</font>
</b><br><br>
<?
# Offset Calculator 1.1.1
# http://www.jholman.com/scripts/offset/
# Copyright © 2003-2004 Jeff Holman
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# See license.txt for the terms of the GNU GPL.
#
# See help.html for installation and usage instructions.
?>
<?
if ($_POST['submit']) {
$offset = round(((mktime($hour, $minute, $second, $month, $day, $year) - mktime())/(3600)),0);
?>
<p>Necesitas modificar la hora del servidor <span class="offset"><? echo $offset; ?></span>
horas para que sea igual a la hora local.
<p>(Hora Servidor + <span class="offset"><? echo $offset; ?></span> = Hora Local)</p>
<p>[<a href="../<? echo $_SERVER['PHP_SELF']; ?>">Volver</a>]</p>
<?
exit();
}
$server['y'] = date('Y') + 0;
$server['m'] = date('m') + 0;
$server['d'] = date('d') + 0;
$server['h'] = date('H') + 0;
$server['i'] = date('i') + 0;
$server['s'] = date('s') + 0;
?>
<form method="post" action="<? echo $_SERVER['PHP_SELF'] ?>">
<p><b>Entra la fecha local y la hora (para determinar la diferencia):</b></p>
<p><b>Fecha:</b>
<select name="month" id="month">
<?
for ($i=1;$i<=12;$i++) {
?>
<option value="<? echo $i; ?>"<? if ($server['m'] == $i) echo " SELECTED"; ?>><? echo date("F", mktime(0,0,0,$i)); ?></option>
<?
}
?>
</select>
<select name="day" id="day">
<?
for ($i=1;$i<=31;$i++) {
?>
<option value="<? echo $i; ?>"<? if ($server['d'] == $i) echo " SELECTED"; ?>><? echo $i; ?></option>
<?
}
?>
</select>
<input name="year" type="text" id="year" size="4" maxlength="4" value="<? echo $server['y']; ?>">
(cambia la fecha si incorrecta)</p>
<p><b>Hora:</b>
<select name="hour" id="hour">
<option value="0" selected>- Hour -</option>
<option value="0"></option>
<?
for ($i=0;$i<24;$i++) {
?>
<option value="<? echo $i; ?>"><? echo date("ga", mktime($i)); ?></option>
<?
}
?>
</select>
: <? echo date('i'); ?> : <? echo date('s'); ?>
<script language="JavaScript">document.write(' (Cambia la fecha si incorrecta)')</script>
</p>
<p>
<input type="hidden" name="minute" value="<? echo date('i') + 0; ?>">
<input type="hidden" name="second" value="<? echo date('s') + 0; ?>">
<input type="submit" name="submit" value="Calcula diferencia">
</p>
</form>
<script language="JavaScript">
var date = new Date();
var year = date.getYear();
if (year < 2000) year += 1900;
document.getElementById('year').value = year;
document.getElementById('month').value = date.getMonth() + 1;
document.getElementById('day').value = date.getDate();
document.getElementById('hour').value = date.getHours();
</script>
<p><a href="http://www.jholman.com/scripts/offset/">Offset Calculator 1.1.1</a></p>
</center>
</body>
</html>