Ég fæ bara villu en ertu að meina svona cookie
[?php
if (!isset($id)) {
srand((double)microtime()*1000000);
$val_of_rand = rand();
setcookie(“id”,$val_of_rand,time()+14400,“/”,“.síða.eihvað”,0);
}
function online() {
global $user, $cookie;
cookiedecode($user);
$ip = getenv(“REMOTE_ADDR”);
$username = $cookie[1];
if (!isset($username)) {
$username = “$ip”;
$guest = 1;
}
$past = time()-900;
mysql_query(“DELETE FROM session WHERE time < $past”);
$result = mysql_query(“SELECT time FROM session WHERE username='$username'”);
$ctime = time();
if ($row = mysql_fetch_array($result)) {
mysql_query(“UPDATE session SET username='$username', time='$ctime', host_addr='$ip', guest='$guest' WHERE username='$username'”);
} else {
mysql_query(“INSERT INTO session (username, time, host_addr, guest) VALUES ('$username', ‘$ctime’, ‘$ip’, ‘$guest’)”);
}
$result = mysql_query(“SELECT username FROM session where guest=1”);
$guest_online_num = mysql_num_rows($result);
$result = mysql_query(“SELECT username FROM session where guest=0”);
$member_online_num = mysql_num_rows($result);
$who_online_num = $guest_online_num + $member_online_num;
$who_online = “
”.translate(“Nú eru:,”).“ $guest_online_num ”.translate(“gestir og”).“ $member_online_num ”.translate(“skráðir notendur á síðunni.”).“
”;
$title = “Hvað á að vera hér?”.translate(“ha ha ha hverjir eru inni :)”).“”;
$content = “$who_online”;
if ($user) {
}?]