når så fik jeg det til at virke.. smider du et svar roenving..
<?php
/* online.php */
require_once("sql.conn.php");
$timout = 10000; /* 10 sekunder */
if (!isset($_GET["title"]) && !isset($_GET["requist"]) && !isset($_GET["timeout"]))
{
header("Content-Type: application/x-javascript");
echo "var title=encodeURIComponent(document.title);var requist=window.location.href;";
echo "document.write('<img src=\"$_SERVER[PHP_SELF]?title='+title+'&requist='+requist+'\" ";
echo "onload=\"t=this;window.setTimeout(function(){t.src=\'$_SERVER[PHP_SELF]?timeout=\'+new Date().getTime()},$timout)\">');";
exit;
}
if (isset($_GET["timeout"]))
{
$strSQL = "UPDATE online SET dato=UNIX_TIMESTAMP() WHERE ipaddr=INET_ATON('$_SERVER[REMOTE_ADDR]');";
mysql_query($strSQL, $sqlConn);
}
if (isset($_GET["title"]) && isset($_GET["requist"]))
{
$userid = (isset($_SESSION["USER_ID"]))?$_SESSION["USER_ID"]:0;
$strSQL = "REPLACE INTO online (id, dato, userid, ipaddr, requist, pagetitle)
(SELECT (SELECT id FROM online WHERE ipaddr=INET_ATON('$_SERVER[REMOTE_ADDR]') LIMIT 1) AS id,
UNIX_TIMESTAMP() AS dato, $userid AS userid, INET_ATON('$_SERVER[REMOTE_ADDR]') AS ipaddr,
'$_GET[requist]' AS requist, '$_GET[title]' AS pagetitle);";
mysql_query($strSQL, $sqlConn);
}
header("Content-Type: image/gif");
echo base64_decode('R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAEALAAAAAABAAEAAAIBTAA7'); /* gif billede 1 x 1 pixls */
/* online.php */
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<title>Online side</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<script type="text/javascript" src="online.php"></script>
</body>
</html>