diff --git a/homepage/redesign2018/markdownExperiment/admin/phpcount/phpcountLog.php b/homepage/redesign2018/markdownExperiment/admin/phpcount/phpcountLog.php index d2c816c..e24cce6 100644 --- a/homepage/redesign2018/markdownExperiment/admin/phpcount/phpcountLog.php +++ b/homepage/redesign2018/markdownExperiment/admin/phpcount/phpcountLog.php @@ -13,47 +13,65 @@ try{ $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" + $dailyHitsQuery = $dbConnection->prepare( + "SELECT COUNT(*) AS anz, DATE(timeStamp) as date FROM `phpcount_pageHits` 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); - + $dailyHitsQuery->execute(); + $dailyHitsList = $dailyHitsQuery->fetchAll(PDO::FETCH_ASSOC); + + $whereClauses=array(); + if($_GET['userHash']) + $whereClauses[]="userHash='".$_GET['userHash']."'"; + if($_GET['date']) + $whereClauses[]="DATE(timestamp)='".$_GET['date']."'"; + if($_GET['pageId']) + $whereClauses[]="pageId='".urldecode($_GET['pageId'])."'"; + + $whereClause = join(" AND ", $whereClauses); + $pagehitsQuery = $dbConnection->prepare( - "SELECT timeStamp, pageId, userHash FROM `phpcount_pageHits` ORDER BY timeStamp DESC;" + "SELECT DATE(timeStamp) as date, TIME(timestamp) as time, pageId, userHash, userAgentString FROM `phpcount_pageHits` ". + ($whereClause?"WHERE ".$whereClause." ":""). + "ORDER BY timeStamp DESC;" ); $pagehitsQuery->execute(); $pagehitsList = $pagehitsQuery->fetchAll(PDO::FETCH_ASSOC); + +// var_dump($_GET); + if($_GET['action']=="deleteHitter"){ + //var_dump($_GET['action']); + $deleteHitterQuery = $dbConnection->prepare( + "DELETE FROM `phpcount_pageHits` WHERE userHash=:userHash;" + ); + $deleteHitterQuery->bindParam(':userHash', $_GET['userHash']); + if($deleteHitterQuery->execute()); + else echo("FEHLER\n"); + } } catch(PDOException $db_error){ die( "Error!: " . $db_error->getMessage() ); } +//var_dump($dailyHitsList); ?>