( ! ) Notice: Undefined variable: where in /var/www/html/pages/wiki.php(45) : eval()'d code on line 93 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Call Stack | ||||||||||||||||
# | Time | Memory | Function | Location | ||||||||||||
1 | 0.0000 | 359336 | {main}( ) | .../index.php:0 | ||||||||||||
2 | 0.0035 | 387816 | include( '/var/www/html/pages/wiki.php' ) | .../index.php:48 | ||||||||||||
3 | 0.0091 | 502832 | includestring( ) | .../wiki.php:482 | ||||||||||||
4 | 0.0093 | 540872 | eval( '?> $session["log_date"], "type" => "start"];
$timestamps[] = ["timestamp" => $session["last_seen"], "type" => "end"];
}
}
usort($timestamps, function ($a, $b) {
if ($a["timestamp"] == $b["timestamp"]) {
return $a["type"] == "end" ? -1 : 1;
}
return $a["timestamp"] - $b["timestamp"];
});
$currentPlayers = 0;
$maxConcurrentPlayers = 0;
foreach ($timestamps as $timestamp) {
if ($timestamp["type"] == "start") {
$currentPlayers++;
$maxConcurrentPlayers = max($maxConcurrentPlayers, $currentPlayers);
} else {
$currentPlayers--;
}
}
return $maxConcurrentPlayers;
}
class DateIdConverter {
private const REFERENCE_DATE = '2019-10-30';
private const INITIAL_ID = 0;
public static function convertDateToId($date) {
$referenceDate = new DateTime(self::REFERENCE_DATE);
$givenDate = new DateTime($date);
$daysDifference = $referenceDate->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
}
}
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 = [];
$playerCount = [];
$filter = [];
$filter["$where"] = "function() { return this.day_id == 1399}";
$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["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;
}
foreach ($days as $day)
{
if($day != null)
{
//$stat = [];
$username = $day["username"];
$dayInfos = getDay(isset($stats[$username]) ? $stats[$username] : null, $day);
$stats[$username] = $dayInfos;
$dayId = $day["day_id"];
if(!isset($playerCount[$dayId]))
{
$playerCount[$dayId]["totalplayers"] = 0;
$playerCount[$dayId]["days"] = [];
}
$playerCount[$dayId]["totalplayers"] ++;
$strictDay = ["sessions" => $dayInfos["sessions"]];
array_push($playerCount[$dayId]["days"], $strictDay);
}
}
//usort($stats, "cmp");
function cmpActiveTime($a, $b)
{
return (($b["total_time"] - $b["afk_time"]) - ($a["total_time"] - $a["afk_time"]));
}
//usort($playerCount, "cmp");
usort($stats, "cmpActiveTime");
?>
$value)
{
$points[] = [DateIdConverter::convertIdToTimestamp($key), findMaxConcurrentPlayers($value["days"])];
}
$jsonChart = ["max_players" => $points];
?>
$value)
{
echo $key . "/ total: " . $value["totalplayers"] . " )"; //var_dump($value["days"]); echo findMaxConcurrentPlayers($value["days"]); echo " "; }*/ ?>
| .../wiki.php:45 |
( ! ) Fatal error: Uncaught MongoDB\Driver\Exception\InvalidArgumentException: Cannot use empty keys in filter document in /var/www/html/vendor/mongodb/mongodb/src/Operation/Find.php on line 322 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
( ! ) MongoDB\Driver\Exception\InvalidArgumentException: Cannot use empty keys in filter document in /var/www/html/vendor/mongodb/mongodb/src/Operation/Find.php on line 322 | ||||||||||||||||
Call Stack | ||||||||||||||||
# | Time | Memory | Function | Location | ||||||||||||
1 | 0.0000 | 359336 | {main}( ) | .../index.php:0 | ||||||||||||
2 | 0.0035 | 387816 | include( '/var/www/html/pages/wiki.php' ) | .../index.php:48 | ||||||||||||
3 | 0.0091 | 502832 | includestring( ) | .../wiki.php:482 | ||||||||||||
4 | 0.0093 | 540872 | eval( '?> $session["log_date"], "type" => "start"];
$timestamps[] = ["timestamp" => $session["last_seen"], "type" => "end"];
}
}
usort($timestamps, function ($a, $b) {
if ($a["timestamp"] == $b["timestamp"]) {
return $a["type"] == "end" ? -1 : 1;
}
return $a["timestamp"] - $b["timestamp"];
});
$currentPlayers = 0;
$maxConcurrentPlayers = 0;
foreach ($timestamps as $timestamp) {
if ($timestamp["type"] == "start") {
$currentPlayers++;
$maxConcurrentPlayers = max($maxConcurrentPlayers, $currentPlayers);
} else {
$currentPlayers--;
}
}
return $maxConcurrentPlayers;
}
class DateIdConverter {
private const REFERENCE_DATE = '2019-10-30';
private const INITIAL_ID = 0;
public static function convertDateToId($date) {
$referenceDate = new DateTime(self::REFERENCE_DATE);
$givenDate = new DateTime($date);
$daysDifference = $referenceDate->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
}
}
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 = [];
$playerCount = [];
$filter = [];
$filter["$where"] = "function() { return this.day_id == 1399}";
$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["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;
}
foreach ($days as $day)
{
if($day != null)
{
//$stat = [];
$username = $day["username"];
$dayInfos = getDay(isset($stats[$username]) ? $stats[$username] : null, $day);
$stats[$username] = $dayInfos;
$dayId = $day["day_id"];
if(!isset($playerCount[$dayId]))
{
$playerCount[$dayId]["totalplayers"] = 0;
$playerCount[$dayId]["days"] = [];
}
$playerCount[$dayId]["totalplayers"] ++;
$strictDay = ["sessions" => $dayInfos["sessions"]];
array_push($playerCount[$dayId]["days"], $strictDay);
}
}
//usort($stats, "cmp");
function cmpActiveTime($a, $b)
{
return (($b["total_time"] - $b["afk_time"]) - ($a["total_time"] - $a["afk_time"]));
}
//usort($playerCount, "cmp");
usort($stats, "cmpActiveTime");
?>
$value)
{
$points[] = [DateIdConverter::convertIdToTimestamp($key), findMaxConcurrentPlayers($value["days"])];
}
$jsonChart = ["max_players" => $points];
?>
$value)
{
echo $key . "/ total: " . $value["totalplayers"] . " )"; //var_dump($value["days"]); echo findMaxConcurrentPlayers($value["days"]); echo " "; }*/ ?>
| .../wiki.php:45 | ||||||||||||
5 | 0.0097 | 541576 | MongoDB\Collection->find( ) | .../wiki.php(45) : eval()'d code:95 | ||||||||||||
6 | 0.0097 | 542496 | MongoDB\Operation\Find->execute( ) | .../Collection.php:663 | ||||||||||||
7 | 0.0097 | 543000 | __construct ( ) | .../Find.php:322 |