[code]$f = "
<html><head><script type=\'text/javascript\'>
var d = new Date()
document.write(d.getHours())
</script></head></html>
";
$h = $f;
if ($h > 6 and $h < 18)
{
$theme_dir = "new-images/nav-light";
}
else
{
$theme_dir = "new-images/nav-dark";
}[/code]
any one know why that wont work? if i change it to make it echo instead of setting it to $f it will work....
us3rX <img src=\'http://www.killanet.net/forum3/public/s ... /ph34r.gif\' class=\'bbc_emoticon\' alt=\':ph34r:\' />
Local Time
Moderators: Moderator, Global Moderator
Local Time
[align=center]

"Time is never wasted, when your wasted all the time" ~ Radio Dj/Unknown Source
"Death is the inevitable end to the suffering of the living." ~Unknown
"You were born an original. Don't die a copy" ~Murdoc Niccals
[/align]

"Time is never wasted, when your wasted all the time" ~ Radio Dj/Unknown Source
"Death is the inevitable end to the suffering of the living." ~Unknown
"You were born an original. Don't die a copy" ~Murdoc Niccals
[/align]
Local Time
That quite simply, won\'t work. <img src=\'http://www.killanet.net/forum3/public/s ... /blush.gif\' class=\'bbc_emoticon\' alt=\'(blush)\' />
This does:
cookie.js:
[code]function setCookie(name,value)
{
var exdate=new Date()
exdate.setTime(exdate.getTime()+(3600*1000))
document.cookie=name+ "=" +escape(value)+ "; expires="+exdate
}
function getCookie(name)
{
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1)
{
begin = dc.indexOf(prefix);
if (begin != 0) return null;
}
else
{
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
if (end == -1)
{
end = dc.length;
}
return unescape(dc.substring(begin + prefix.length, end));
}[/code]
index.php (or whatever): [code]<html>
<head>
<script src="cookie.js" type="text/javascript"></script>
<script>
var c = getCookie(\'h\')
var d = new Date()
var h = d.getHours()
setCookie("h", h)
if (c == null) {
window.location.href="test.php"
}
</script>
</head>
<body>
<?php
echo $_COOKIE[\'h\'];
?>
</body>
</html>[/code]
I think you\'ll be fine from now on in <img src=\'http://www.killanet.net/forum3/public/s ... /smile.gif\' class=\'bbc_emoticon\' alt=\':)\' />
This does:
cookie.js:
[code]function setCookie(name,value)
{
var exdate=new Date()
exdate.setTime(exdate.getTime()+(3600*1000))
document.cookie=name+ "=" +escape(value)+ "; expires="+exdate
}
function getCookie(name)
{
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1)
{
begin = dc.indexOf(prefix);
if (begin != 0) return null;
}
else
{
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
if (end == -1)
{
end = dc.length;
}
return unescape(dc.substring(begin + prefix.length, end));
}[/code]
index.php (or whatever): [code]<html>
<head>
<script src="cookie.js" type="text/javascript"></script>
<script>
var c = getCookie(\'h\')
var d = new Date()
var h = d.getHours()
setCookie("h", h)
if (c == null) {
window.location.href="test.php"
}
</script>
</head>
<body>
<?php
echo $_COOKIE[\'h\'];
?>
</body>
</html>[/code]
I think you\'ll be fine from now on in <img src=\'http://www.killanet.net/forum3/public/s ... /smile.gif\' class=\'bbc_emoticon\' alt=\':)\' />
Last edited by Scott on Mon Nov 14, 2005 12:28 pm, edited 1 time in total.
Local Time
thank you, again scott <img src=\'http://www.killanet.net/forum3/public/s ... iggrin.gif\' class=\'bbc_emoticon\' alt=\':D\' />
us3rX <img src=\'http://www.killanet.net/forum3/public/s ... /ph34r.gif\' class=\'bbc_emoticon\' alt=\':ph34r:\' />
us3rX <img src=\'http://www.killanet.net/forum3/public/s ... /ph34r.gif\' class=\'bbc_emoticon\' alt=\':ph34r:\' />
[align=center]

"Time is never wasted, when your wasted all the time" ~ Radio Dj/Unknown Source
"Death is the inevitable end to the suffering of the living." ~Unknown
"You were born an original. Don't die a copy" ~Murdoc Niccals
[/align]

"Time is never wasted, when your wasted all the time" ~ Radio Dj/Unknown Source
"Death is the inevitable end to the suffering of the living." ~Unknown
"You were born an original. Don't die a copy" ~Murdoc Niccals
[/align]

