PHP expert |
|
ok, heb eens een php-nuke script gelezen en daar gebruiken ze de volgende code:
function online() {
global $user, $cookie, $prefix, $db;
cookiedecode($user);
$ip = $_SERVER["REMOTE_ADDR"];
$uname = $cookie[1];
if (!isset($uname)) {
$uname = "$ip";
$guest = 1;
}
$past = time()-3600;
$db->sql_query("DELETE FROM ".$prefix."_session WHERE time < '$past'");
$result = $db->sql_query("SELECT time FROM ".$prefix."_session WHERE uname='$uname'");
$ctime = time();
if ($row = $db->sql_fetchrow($result)) {
$db->sql_query("UPDATE ".$prefix."_session SET uname='$uname', time='$ctime', host_addr='$ip', guest='$guest' WHERE uname='$uname'");
} else {
$db->sql_query("INSERT INTO ".$prefix."_session (uname, time, host_addr, guest) VALUES ('$uname', '$ctime', '$ip', '$guest')");
}
}
function online() { global $user, $cookie, $prefix, $db; cookiedecode($user); $ip = $_SERVER["REMOTE_ADDR"]; $uname = $cookie[1]; $uname = "$ip"; $guest = 1; } $db->sql_query("DELETE FROM ".$prefix."_session WHERE time < '$past'"); $result = $db->sql_query("SELECT time FROM ".$prefix."_session WHERE uname='$uname'"); if ($row = $db->sql_fetchrow($result)) { $db->sql_query("UPDATE ".$prefix."_session SET uname='$uname', time='$ctime', host_addr='$ip', guest='$guest' WHERE uname='$uname'"); } else { $db->sql_query("INSERT INTO ".$prefix."_session (uname, time, host_addr, guest) VALUES ('$uname', '$ctime', '$ip', '$guest')"); } }
Kan ik starten van deze code??
en kan iemand een uitleggen wat time(); weergeeft in php.net zeggen ze het volgende:
Citaat: Retourneert de huidige tijd gemeten in het aantal seconden sinds de Unix Epoch (January 1 1970 00:00:00 GMT).
groeten stijn |