DayZ-Stat-Server/GraphPlayer.php

48 lines
1.2 KiB
PHP
Raw Normal View History

2021-01-31 13:16:02 +01:00
<?php
2021-02-04 20:59:35 +01:00
//ini_set('display_errors', 'on');
2021-01-31 18:56:08 +01:00
2021-02-06 13:40:40 +01:00
include_once('config/config.php');
include_once('config/consql.php');
2021-01-31 18:56:08 +01:00
// MYSQL table
2021-02-04 18:00:02 +01:00
// $StatServer = "StatServer_20"; // set in consql.php
2021-01-31 18:56:08 +01:00
2021-02-04 18:00:02 +01:00
$queryP = "SELECT date, players FROM ".$StatServer." ORDER BY id DESC LIMIT 80";
$arrPlay = $con->query($queryP);
2021-01-31 13:16:02 +01:00
?>
<head>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.2/raphael-min.js"></script>
2021-01-31 18:56:08 +01:00
2021-01-31 13:16:02 +01:00
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/prettify/r224/prettify.min.css">
2021-01-31 18:56:08 +01:00
<script src="morris/morris.js"></script>
2021-01-31 13:16:02 +01:00
<link rel="stylesheet" href="morris/morris.css">
</head>
2021-01-31 18:56:08 +01:00
<body>
2021-02-05 00:18:56 +01:00
<h3> Players on <small style='color: grey;'> <?php echo $Info['HostName']; ?></small></h3>
2021-02-04 18:00:02 +01:00
2021-01-31 13:16:02 +01:00
<div id="graph32"></div>
<script>
2021-02-04 18:00:02 +01:00
var day_data = [<?php while($row = mysqli_fetch_assoc($arrPlay)){ echo "{'Date': '".$row["date"]."', 'Players': ".$row["players"]."}, "; } ?> ];
2021-01-31 13:16:02 +01:00
Morris.Line({
element: 'graph32',
data: day_data,
xkey: 'Date',
ykeys: ['Players'],
labels: ['Players on <?php echo $namemap ;?>'],
yLabelFormat: function(y){return y != Math.round(y)?'':y;},
grid: false,
//ymin: 0,
//parseTime: false,
hideHover:'auto'
});
</script>
</body>
2021-01-31 18:56:08 +01:00