That quite simply, won't work. /blush.gif' class='bbc_emoticon' alt='(blush)' />
This does:
cookie.js:
Code: Select all
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));
}
index.php (or whatever):
Code: Select all
<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>
I think you'll be fine from now on in /smile.gif' class='bbc_emoticon' alt=':)' />