aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-11-04 23:26:22 +0000
committerz0rglub <z0rglub@piwigo.org>2004-11-04 23:26:22 +0000
commitd2884e69ce33718e83f7da93adae0ba8a86d68cc (patch)
tree8629cf55c3cb1360841d425e07adb673bdf85752
parent5b7c761bbf1c962ec328c7c307529c58ba74e084 (diff)
in queries table names use the constant and not hard coded table name
git-svn-id: http://piwigo.org/svn/trunk@591 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/stats.php36
1 files changed, 21 insertions, 15 deletions
diff --git a/admin/stats.php b/admin/stats.php
index 6a2dae892..41df7b61b 100644
--- a/admin/stats.php
+++ b/admin/stats.php
@@ -47,11 +47,13 @@ $template->assign_vars(array(
));
//---------------------------------------------------------------- log history
-$query = "SELECT DISTINCT COUNT(*) as p,
- MONTH(date) as m,
- YEAR(date) as y
- FROM phpwg_history
- GROUP BY DATE_FORMAT(date,'%Y-%m') DESC;";
+$query = '
+SELECT DISTINCT COUNT(*) as p,
+ MONTH(date) as m,
+ YEAR(date) as y
+ FROM '.HISTORY_TABLE.'
+ GROUP BY DATE_FORMAT(date,\'%Y-%m\') DESC
+;';
$result = pwg_query( $query );
$i=0;
while ( $row = mysql_fetch_array( $result ) )
@@ -60,19 +62,23 @@ while ( $row = mysql_fetch_array( $result ) )
if ($row['m'] <10) {$current_month.='0';}
$current_month .= $row['m'];
// Number of pictures seen
- $query = "SELECT COUNT(*) as p,
- FILE as f
- FROM phpwg_history
- WHERE DATE_FORMAT(date,'%Y-%m') = '$current_month'
- AND FILE = 'picture'
- GROUP BY FILE;";
+ $query = '
+SELECT COUNT(*) as p,
+ FILE as f
+ FROM '.HISTORY_TABLE.'
+ WHERE DATE_FORMAT(date,\'%Y-%m\') = \''.$current_month.'\'
+ AND FILE = \'picture\'
+ GROUP BY FILE
+;';
$pictures = mysql_fetch_array(pwg_query( $query ));
// Number of different visitors
- $query = "SELECT COUNT(*) as p, login
- FROM phpwg_history
- WHERE DATE_FORMAT(date,'%Y-%m') = '$current_month'
- GROUP BY login, IP;";
+ $query = '
+SELECT COUNT(*) as p, login
+ FROM '.HISTORY_TABLE.'
+ WHERE DATE_FORMAT(date,\'%Y-%m\') = \''.$current_month.'\'
+ GROUP BY login, IP
+;';
$user_results = pwg_query( $query );
$nb_visitors = 0;
$auth_users = array();