ok. Jeg har nu siddet og rodet lidt. Men jeg må have glemt noget på det sidste.. hehe Jeg kan simpelt hen bare ikke få det til at virke.
Så derfor prøver jeg lige at poste hele scriptet. Det er nede i bunden af scriptet at de benævnte linier befinder sig imellem kommentar linierne. Den øverste viser besøg ialt og den næste det gennemsnitlige antal besøg (siden sitets oprettelse)
Den nedenunder kan jeg kun få til at give et resultat på ca 5.
Det er ikke lykkedes at få implementeret den foreslåede linie i scriptet, da den bliver ved med at give fejl uanset hvordan jeg ændre/tilpasser den.
Det skal siges at det er et sideelement til php-fusion v. 7.0.5
Her er scriptet på side elementet:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2007 Nick Jones
|
http://www.php-fusion.co.uk/+--------------------------------------------------------+
| Filename: online_users_panel.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at
www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
$result = dbquery("SELECT * FROM ".DB_ONLINE." WHERE online_user=".($userdata['user_level'] != 0 ? "'".$userdata['user_id']."'" : "'0' AND online_ip='".USER_IP."'"));
if (dbrows($result)) {
$result = dbquery("UPDATE ".DB_ONLINE." SET online_lastactive='".time()."' WHERE online_user=".($userdata['user_level'] != 0 ? "'".$userdata['user_id']."'" : "'0' AND online_ip='".USER_IP."'")."");
} else {
$result = dbquery("INSERT INTO ".DB_ONLINE." (online_user, online_ip, online_lastactive) VALUES ('".($userdata['user_level'] != 0 ? $userdata['user_id'] : "0")."', '".USER_IP."', '".time()."')");
}
$result = dbquery("DELETE FROM ".DB_ONLINE." WHERE online_lastactive<".(time()-60)."");
opensidex($locale['global_010'],"on");
$result = dbquery("SELECT * FROM ".DB_USERS." ORDER BY user_lastvisit DESC LIMIT 0,10");
echo "<table width='100%' cellpadding='0' cellspacing='0'>";
if (dbrows($result) != 0) {
while ($data = dbarray($result)) {
$lastseen = time() - $data['user_lastvisit'];
$iW = sprintf("%2d",floor($lastseen/604800));
$iD = sprintf("%2d",floor($lastseen/(60*60*24)));
$iH = sprintf("%02d",floor((($lastseen%604800)%86400)/3600));
$iM = sprintf("%02d",floor(((($lastseen%604800)%86400)%3600)/60));
$iS = sprintf("%02d",floor((((($lastseen%604800)%86400)%3600)%60)));
if ($lastseen < 60) {
$lastseen = "<img src='".BASEDIR."images/smiley100.gif' alt='' />";
} elseif ($lastseen < 120) {
$lastseen = "<img src='".BASEDIR."images/smiley090.gif' alt='' />";
} elseif ($lastseen < 180) {
$lastseen = "<img src='".BASEDIR."images/smiley080.gif' alt='' />";
} elseif ($lastseen < 240) {
$lastseen = "<img src='".BASEDIR."images/smiley070.gif' alt='' />";
} elseif ($lastseen < 300) {
$lastseen = "<img src='".BASEDIR."images/smiley060.gif' alt='' />";
} elseif ($lastseen < 360) {
$lastseen = "<img src='".BASEDIR."images/smiley050.gif' alt='' />";
} elseif ($lastseen < 420) {
$lastseen = "<img src='".BASEDIR."images/smiley040.gif' alt='' />";
} elseif ($lastseen < 480) {
$lastseen = "<img src='".BASEDIR."images/smiley030.gif' alt='' />";
} elseif ($lastseen < 540) {
$lastseen = "<img src='".BASEDIR."images/smiley020.gif' alt='' />";
} elseif ($lastseen < 600) {
$lastseen = "<img src='".BASEDIR."images/smiley010.gif' alt='' />";
} elseif ($iW > 0) {
if ($iW == 1) { $Text = "Uge"; } else { $Text = "Uger"; }
$lastseen = $iW." ".$Text;
} elseif ($iD > 0) {
if ($iD == 1) { $Text = "Dag"; } else { $Text = "Dage"; }
$lastseen = $iD." ".$Text;
} else {
$lastseen = $iH.":".$iM.":".$iS;
}
echo "<tr><td class='small' align='left'><img src='".THEME."images/bullet.gif' alt='' /> <a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' title='".$data['user_name']."' class='side'>";
echo trimlink($data['user_name'], 13)." </a></td><td class='small2' align='right'>".$lastseen."</td></tr>";
}
}
echo "</table>";
$result = dbquery(
"SELECT ton.*, tu.user_id,user_name FROM ".DB_ONLINE." ton
LEFT JOIN ".DB_USERS." tu ON ton.online_user=tu.user_id"
);
$guests = 0; $members = array();
while ($data = dbarray($result)) {
if ($data['online_user'] == "0") {
$guests++;
} else {
array_push($members, array($data['user_id'], $data['user_name']));
}
}
echo "<hr width='95%' color='#B0B0B0'>";
echo THEME_BULLET." ".$locale['global_011'].": ".$guests."<br />\n";
echo THEME_BULLET." ".$locale['global_012'].": ".count($members)."<br />\n";
if (count($members)) {
$i = 1;
while (list($key, $member) = each($members)) {
}
}
echo "<hr width='95%' color='#B0B0B0'>";
if (iADMIN && checkrights("M") && $settings['admin_activation'] == "1") {
echo THEME_BULLET." <a href='".ADMIN."members.php".$aidlink."&status=2' class='side'>".$locale['global_015']."</a>";
echo ": ".dbcount("(user_id)", DB_USERS, "user_status='2'")."<br />\n";
}
echo "\n".THEME_BULLET." ".$locale['global_014'].": ".number_format(dbcount("(user_id)", DB_USERS, "user_status<='1'"))."<br />\n";
$data = dbarray(dbquery("SELECT user_id,user_name FROM ".DB_USERS." WHERE user_status='0' ORDER BY user_joined DESC LIMIT 0,1"));
echo THEME_BULLET." ".$locale['global_016'].": <a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' class='side'>".$data['user_name']."</a><br />\n";
echo "<hr width='95%' color='#B0B0B0'>";
//echo THEME_BULLET." Besøg ialt: ".$settings['counter']."<br />\n";
//echo THEME_BULLET." Gennemsnit: ";echo ceil($settings['counter']/(between_days("2008-10-01 02:20:30", "now")))."<br />\n";
//echo THEME_BULLET." Sidste 24 timer: ";echo ceil($settings['counter']/(between_days(-60*60*24 , "now")))."";
//WHERE datetime_felt >= DATE_SUB(NOW(),INTERVAL 24 HOUR)
closesidex();
?>
Håber at det kan give et lidt bedre intryk af min problematik.
Det er helt rigtigt at det jeg efterspørger er:
En tæller som viser antal besøg inden for de sidste 24 timer