Files
cwsvJudo/homepage/redesign2018/markdownExperiment/admin/phpcount/phpcountLog.php
marko 59b35c4160 - pageHits werden jetzt einzeln mit Zeit geloggt
modified:   homepage/redesign2018/markdownExperiment/admin/phpcount/phpcountLog.php
	modified:   homepage/redesign2018/markdownExperiment/config/phpcount.config.php
2018-09-03 14:37:16 +02:00

61 lines
2.0 KiB
PHP

<?php
$basePath = "/users/cwsvjudo/www";
require_once($basePath."/config/cwsvJudo.config.php");
require_once($basePath."/ressourcen/phpLib/phplot/phplot.php");
require_once($basePath."/ressourcen/phpLib/phplot/rgb.inc.php");
try{
$dbConnection = new PDO(
'mysql:host='.$cwsvJudoConfig["db"]["host"].';dbname='.$cwsvJudoConfig["db"]["name"],
$cwsvJudoConfig["db"]["user"],
$cwsvJudoConfig["db"]["password"]
);
$nodupesQuery = $dbConnection->prepare(
"SELECT COUNT(*) AS anz, DATE(FROM_UNIXTIME( time )) as date FROM `phpcount_nodupes` GROUP BY date ORDER BY date DESC"
);
$nodupesQuery->execute();
$nodupesList = $nodupesQuery->fetchAll(PDO::FETCH_ASSOC);
$uniqueHitsQuery = $dbConnection->prepare(
"SELECT pageid, hitcount FROM `phpcount_hits` WHERE isunique=1 ORDER BY hitcount DESC"
);
$uniqueHitsQuery->execute();
$uniqueHitsList = $uniqueHitsQuery->fetchAll(PDO::FETCH_ASSOC);
$pagehitsQuery = $dbConnection->prepare(
"SELECT timeStamp, pageId, userHash FROM `phpcount_pageHits` ORDER BY timeStamp DESC;"
);
$pagehitsQuery->execute();
$pagehitsList = $pagehitsQuery->fetchAll(PDO::FETCH_ASSOC);
}
catch(PDOException $db_error){
die( "Error!: " . $db_error->getMessage() );
}
?>
<html>
<body>
<img src="visitorCount.phplot.php" />
<table>
<tr><th>date</th><th>times</th></tr>
<?php foreach($nodupesList as $nodupesEntry)
echo( "\t\t\t\t<tr><td>".$nodupesEntry['date']."</td><td>".$nodupesEntry['anz']."<td></tr>" );
?>
</table>
<table>
<tr><th>Seite</th><th>times</th></tr>
<?php foreach($uniqueHitsList as $uniqueHitsEntry)
echo( "\t\t\t\t<tr><td>".$uniqueHitsEntry['pageid']."</td><td>".$uniqueHitsEntry['hitcount']."<td></tr>" );
?>
</table>
<table>
<tr><th>timeStamp</th><th>pageId</th><th>userHash</th></tr>
<?php foreach($pagehitsList as $pagehitsEntry)
echo( "\t\t\t\t<tr><td>".$pagehitsEntry['timeStamp']."</td><td>".$pagehitsEntry['pageId']."</td><td>".substr($pagehitsEntry['userHash'], 0, 5)."...<td></tr>" );
?>
</table>
</body>
</html>