( ! ) Notice: Undefined index: player in /var/www/html/pages/wiki.php(36) : eval()'d code on line 59 | ||||
---|---|---|---|---|
Call Stack | ||||
# | Time | Memory | Function | Location |
1 | 0.0000 | 356232 | {main}( ) | .../index.php:0 |
2 | 0.0045 | 366760 | include( '/var/www/html/pages/wiki.php' ) | .../index.php:47 |
3 | 0.0074 | 411464 | includestring( ) | .../wiki.php:403 |
4 | 0.0077 | 471240 | eval( '?>
diff($givenDate)->days;
return self::INITIAL_ID + $daysDifference;
}
public static function convertIdToDate($id) {
$daysDifference = $id - self::INITIAL_ID;
$referenceDate = new DateTime(self::REFERENCE_DATE);
$newDate = $referenceDate->add(new DateInterval('P' . $daysDifference . 'D'));
return $newDate->format('Y-m-d');
}
public static function convertIdToTimestamp($id) {
$daysDifference = $id - self::INITIAL_ID;
$referenceDate = new DateTime(self::REFERENCE_DATE);
$newDate = $referenceDate->add(new DateInterval('P' . $daysDifference . 'D'));
return $newDate->getTimestamp() * 1000; // Convert to milliseconds
}
public static function getCurrentDateId() {
$currentDate = new DateTime();
$referenceDate = new DateTime(self::REFERENCE_DATE);
$daysDifference = $referenceDate->diff($currentDate)->days;
return self::INITIAL_ID + $daysDifference;
}
}
function formatMilliseconds($milliseconds) {
$seconds = floor($milliseconds / 1000); // Convertir en secondes
$minutes = floor($seconds / 60); // Calculer les minutes
$hours = floor($minutes / 60); // Calculer les heures
$remainingMinutes = $minutes % 60; // Calculer les minutes restantes
$remainingSeconds = $seconds % 60; // Calculer les secondes restantes
$formattedTime = "$hours h $remainingMinutes m $remainingSeconds s";
return $formattedTime;
}
$stats = [];
$filter = [];
$invalid = 1000000000;
$minDay = 0;
$maxDay = $invalid;
if(isset($_GET["interval"]))
{
$intervalStr = $_GET["interval"];
$arr = explode("/", $intervalStr);
$one = DateIdConverter::convertDateToId($arr[0]);
$two = DateIdConverter::convertDateToId($arr[1]);
$minDay = min($one, $two);
$maxDay = max($one, $two);
}
$filter["\$where"] = "function() { return this.day_id >= $minDay && this.day_id <= $maxDay}";
$filter["username"] = $playerName;
$days = Keldatabase::playerDaysDocument()->find($filter, ["sort" => ["day_id" => -1]]);
function getDay($previous, $row)
{
$infos = [];
$infos["username"] = $row["username"];
$infos["afk_time"] = (isset($previous) ? $previous["afk_time"] : 0) + $row["afk_time"];
$infos["build_time"] = (isset($previous) ? $previous["build_time"] : 0) + (isset($row["build_time"]) ? $row["build_time"] : 0);
$infos["sessions"] = $row["sessions"];
$totalTime = isset($previous) ? $previous["total_time"] : 0;
foreach ($row["sessions"] as $sess)
{
$totalTime += $sess["last_seen"] - $sess["log_date"];
}
$infos["total_time"] = $totalTime;
return $infos;
}
$hourCount = [];
$totalHourCount = [];
$lastDayIdFound = -1;
foreach ($days as $day)
{
if($day != null)
{
//$stat = [];
$username = $day["username"];
$dayId = $day["day_id"];
if($lastDayIdFound != -1)
{
for($iii = $lastDayIdFound - 1; $iii > $dayId; $iii --)
{
$hourCount[$iii] = (isset($hourCount[$iii]) ? $hourCount[$iii] : 0);
$totalHourCount[$iii] = (isset($totalHourCount[$iii]) ? $totalHourCount[$iii] : 0);
}
}
if($username == $playerName)
{
$lastDayIdFound = $dayId;
$dayInfos = getDay(isset($stats[$username]) ? $stats[$username] : null, $day);
$singleDayInfos = getDay(null, $day);
$stats[$username] = $dayInfos;
$hourCount[$dayId] = (
isset($hourCount[$dayId]) ? $hourCount[$dayId] : 0)
+ ((($singleDayInfos["total_time"] - $singleDayInfos["afk_time"] - $singleDayInfos["build_time"]) / 1000) / 60) / 60;
$totalHourCount[$dayId] = (
isset($totalHourCount[$dayId]) ? $totalHourCount[$dayId] : 0)
+ ((($singleDayInfos["total_time"] ) / 1000) / 60) / 60;
$strictDay = ["sessions" => $dayInfos["sessions"]];
}
else
{
$hourCount[$dayId] = (isset($hourCount[$dayId]) ? $hourCount[$dayId] : 0);
$totalHourCount[$dayId] = (isset($totalHourCount[$dayId]) ? $totalHourCount[$dayId] : 0);
}
}
}
//usort($stats, "cmp");
function cmpActiveTime($a, $b)
{
return (($b["total_time"] - $b["afk_time"] - $b["build_time"]) - ($a["total_time"] - $a["afk_time"] - $a["afk_time"]));
}
usort($stats, "cmpActiveTime");
?>
$value)
{
$tmsp = DateIdConverter::convertIdToTimestamp($key);
if($tmsp < $i)
{
$i = $tmsp;
}
$points[] = [$tmsp, $value];
}
$points[] = [$i - (24 * (60 * 60 * 1000)), 0];
$i = 10000000000000;
foreach($totalHourCount as $key => $value)
{
$tmsp = DateIdConverter::convertIdToTimestamp($key);
if($tmsp < $i)
{
$i = $tmsp;
}
$points2[] = [$tmsp, $value];
}
//echo $tmsp . " )"; $points2[] = [$i - (24 * (60 * 60 * 1000)), 0]; $jsonChart = ["max_players" => $points]; $jsonChart2 = ["max_players2" => $points2]; ?> Statistiques d'activité getName(); ?>Définir l'interval: Définir Filtres par défaut: Depuis toujours Depuis 7 jours Depuis 30 jours Ce mois Cette semaine Aujourd'hui | .../wiki.php:36 |