Graphiken in den besuchercounter eingefügt

geändert:       admin/phpcount/phpcountLog.php
	neue Datei:     admin/phpcount/visitorCount.phplot.php
	neue Datei:     phpLib/phplot/phplot.php
	neue Datei:     phpLib/phplot/rgb.inc.php
This commit is contained in:
marko
2018-07-01 17:26:31 +02:00
parent 3d412e59d9
commit 5da6531ad0
4 changed files with 10014 additions and 7 deletions

View File

@@ -1,17 +1,29 @@
<?php
// getting a dbConnection
$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=localhost;dbname=cwsvjudo',
'cwsvjudo',
'Dee4oquu'
'mysql:host='.$cwsvJudoConfig["db"]["host"].';dbname='.$cwsvJudoConfig["db"]["name"],
$cwsvJudoConfig["db"]["user"],
$cwsvJudoConfig["db"]["password"]
);
$nodupesQuery = $dbConnection->prepare(
"SELECT * FROM cwsvjudo.phpcount_nodupes;"
"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);
}
catch(PDOException $db_error){
die( "Error!: " . $db_error->getMessage() );
@@ -19,10 +31,17 @@ catch(PDOException $db_error){
?>
<html>
<body>
<img src="visitorCount.phplot.php" />
<table>
<tr><th>ids_hash</th><th>time</th></tr>
<tr><th>date</th><th>times</th></tr>
<?php foreach($nodupesList as $nodupesEntry)
echo( "\t\t\t\t<tr><td>".$nodupesEntry['ids_hash']."</td><td>".date("r", $nodupesEntry['time'])."</tr>" );
echo( "\t\t\t\t<tr><td>".$nodupesEntry['date']."</td><td>".$nodupesEntry['anz']."</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']."</tr>" );
?>
</table>
</body>

View File

@@ -0,0 +1,32 @@
<?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");
// getting a dbConnection
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);
}
catch(PDOException $db_error){
die( "Error!: " . $db_error->getMessage() );
}
$plot = new PHPlot();
$data = array();
foreach($nodupesList as $nodupesEntry)
$data[] = array( $nodupesEntry['date'], $nodupesEntry['anz'] );
$plot->SetDataValues($data);
$plot->DrawGraph();