PHP Classes

File: TimeTaMeR/timezone.php

Recommend this page to a friend!
  Classes of Dennis T Kaplan   TimeTaMeR   TimeTaMeR/timezone.php   Download  
File: TimeTaMeR/timezone.php
Role: Example script
Content type: text/plain
Description: The Javascript
Class: TimeTaMeR
Determine the local and Web user machine time zone
Author: By
Last change: Added help info about reloading the page
Date: 17 years ago
Size: 1,230 bytes
 

Contents

Class file image Download
<html><head>

<script type="text/javascript">
<!--
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
var seconds = currentTime.getSeconds()
if (minutes < 10) minutes = "0" + minutes
if (seconds < 10) seconds = "0" + seconds
if (day < 10) day = "0" + day
if (month < 10) month = "0" + month
var cookietime = (hours + "," + minutes + "," + seconds + "," + month + "," + day + "," + year)
document.cookie = "timeis="+cookietime+"; path=/";
//-->
</script>
</head><body>
<form action=\"nextpage.php\" method=\"post\">
<?php
define
("DBHOST", "localhost");
define("DBTABLE", "PzzAzz");
define("DBUSER", "root");
define("DBPASS", "YourPass");

include
'TimeTaMeR.php';
$TimeTaMeR = new timetamer;
echo
$TimeTaMeR->makeForm();
?>
</form>


<br /><br /><br /><br />
You will get errors the first time you load this page, just reload the page.
The error happens because php tries to read the cookie before javascript sets the cookie. On a live website you would put the Javascript on the previous page.
</body></html>