getting my statistic getting my statistic
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

getting my statistic

Started by pelhrimak, February 25, 2006, 12:45:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pelhrimak

Hello, I have a queston.
How do I get a statistic ? (number of cat, albums, comments, views) + size of all images

Stramm

I guess you already know you have all that stats exc except filesize
two changes need to be done

index.php
find

        $sql = "SELECT sum(hits) FROM {$CONFIG['TABLE_PICTURES']} as p " . 'LEFT JOIN ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'ON p.aid=a.aid ' . 'WHERE 1' . $pic_filter;
        $result = cpg_db_query($sql);
        $nbEnr = mysql_fetch_array($result);
        $hit_count = (int)$nbEnr[0];
        mysql_free_result($result);

        if (count($cat_data)) {
            $statistics = strtr($lang_list_categories['stat1'], array('[pictures]' => $picture_count,
                    '[albums]' => $album_count,
                    '[cat]' => $cat_count,
                    '[comments]' => $comment_count,
                    '[views]' => $hit_count));
        } else {



replace with
        $sql = "SELECT sum(hits) FROM {$CONFIG['TABLE_PICTURES']} as p " . 'LEFT JOIN ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'ON p.aid=a.aid ' . 'WHERE 1' . $pic_filter;
        $result = cpg_db_query($sql);
        $nbEnr = mysql_fetch_array($result);
        $hit_count = (int)$nbEnr[0];
        mysql_free_result($result);

        $sql = "SELECT sum(filesize) FROM {$CONFIG['TABLE_PICTURES']} as p " . 'LEFT JOIN ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'ON p.aid=a.aid ' . 'WHERE 1' . $pic_filter;
        $result = cpg_db_query($sql);
        $nbEnr = mysql_fetch_array($result);
        $size_count = (int)$nbEnr[0];
        mysql_free_result($result);


        if (count($cat_data)) {
            $statistics = strtr($lang_list_categories['stat1'], array('[pictures]' => $picture_count,
                    '[albums]' => $album_count,
                    '[cat]' => $cat_count,
                    '[comments]' => $comment_count,
                    '[size]' => $size_count,
                    '[views]' => $hit_count));
        } else {


in lang/english.php (or the language file your using) find $lang_list_categories, few lines below replace the line starting with
  'stat1' with
  'stat1' => '<b>[pictures]</b> files in <b>[albums]</b> albums and <b>[cat]</b> categories with <b>[comments]</b> comments viewed <b>[views]</b> times, size <b>[size]</b>k',

pelhrimak

Thank and How Do I do a statistic.php with the statistic ?

Stramm

in config enable your anycontent block and add this to it
<?php
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

starttable("100%""Welcome");

    if (
$cat == 0) {
        
$result cpg_db_query("SELECT count(*) FROM {$CONFIG['TABLE_ALBUMS']} as a WHERE 1" $album_filter);
        
$nbEnr mysql_fetch_array($result);
        
$album_count $nbEnr[0];
        
mysql_free_result($result);

        
$sql "SELECT count(*) FROM {$CONFIG['TABLE_PICTURES']} as p " 'LEFT JOIN ' $CONFIG['TABLE_ALBUMS'] . ' as a ' 'ON a.aid=p.aid ' 'WHERE 1' $pic_filter;
        
$result cpg_db_query($sql);
        
$nbEnr mysql_fetch_array($result);
        
$picture_count $nbEnr[0];
        
mysql_free_result($result);

        
$sql "SELECT count(*) FROM {$CONFIG['TABLE_COMMENTS']} as c " 'LEFT JOIN ' $CONFIG['TABLE_PICTURES'] . ' as p ' 'ON c.pid=p.pid ' 'LEFT JOIN ' $CONFIG['TABLE_ALBUMS'] . ' as a ' 'ON a.aid=p.aid ' 'WHERE 1' $pic_filter;
        
$result cpg_db_query($sql);
        
$nbEnr mysql_fetch_array($result);
        
$comment_count $nbEnr[0];
        
mysql_free_result($result);

        
$sql "SELECT count(*) FROM {$CONFIG['TABLE_CATEGORIES']} WHERE 1";
        
$result cpg_db_query($sql);
        
$nbEnr mysql_fetch_array($result);
        
$cat_count $nbEnr[0] - $HIDE_USER_CAT;
        
mysql_free_result($result);

        
$sql "SELECT sum(hits) FROM {$CONFIG['TABLE_PICTURES']} as p " 'LEFT JOIN ' $CONFIG['TABLE_ALBUMS'] . ' as a ' 'ON p.aid=a.aid ' 'WHERE 1' $pic_filter;
        
$result cpg_db_query($sql);
        
$nbEnr mysql_fetch_array($result);
        
$hit_count = (int)$nbEnr[0];
        
mysql_free_result($result);

        
$sql "SELECT sum(filesize) FROM {$CONFIG['TABLE_PICTURES']} as p " 'LEFT JOIN ' $CONFIG['TABLE_ALBUMS'] . ' as a ' 'ON p.aid=a.aid ' 'WHERE 1' $pic_filter;
        
$result cpg_db_query($sql);
        
$nbEnr mysql_fetch_array($result);
        
$size_count = (int)$nbEnr[0];
        
mysql_free_result($result);

echo 
"<tr><td>Albs:"$album_count." - Pics:".$picture_count." - Comments:".$comment_count." - Cats:".$cat_count." - Hits:".$hit_count." - Filesize:".$size_count."</td></tr>";
}
endtable();

?>


pelhrimak

Thanks
else
/ (1024*1024), 2) ." MB"; please .. this is super statistic

pelhrimak

new anycontentm.php
<?php
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

starttable("100%""Statistic this gallery");

    if (
$cat == 0) {
        
$result cpg_db_query("SELECT count(*) FROM {$CONFIG['TABLE_ALBUMS']} as a WHERE 1" $album_filter);
        
$nbEnr mysql_fetch_array($result);
        
$album_count $nbEnr[0];
        
mysql_free_result($result);

        
$sql "SELECT count(*) FROM {$CONFIG['TABLE_PICTURES']} as p " 'LEFT JOIN ' $CONFIG['TABLE_ALBUMS'] . ' as a ' 'ON a.aid=p.aid ' 'WHERE 1' $pic_filter;
        
$result cpg_db_query($sql);
        
$nbEnr mysql_fetch_array($result);
        
$picture_count $nbEnr[0];
        
mysql_free_result($result);

        
$sql "SELECT count(*) FROM {$CONFIG['TABLE_COMMENTS']} as c " 'LEFT JOIN ' $CONFIG['TABLE_PICTURES'] . ' as p ' 'ON c.pid=p.pid ' 'LEFT JOIN ' $CONFIG['TABLE_ALBUMS'] . ' as a ' 'ON a.aid=p.aid ' 'WHERE 1' $pic_filter;
        
$result cpg_db_query($sql);
        
$nbEnr mysql_fetch_array($result);
        
$comment_count $nbEnr[0];
        
mysql_free_result($result);

        
$sql "SELECT count(*) FROM {$CONFIG['TABLE_CATEGORIES']} WHERE 1";
        
$result cpg_db_query($sql);
        
$nbEnr mysql_fetch_array($result);
        
$cat_count $nbEnr[0] - $HIDE_USER_CAT;
        
mysql_free_result($result);

        
$sql "SELECT sum(hits) FROM {$CONFIG['TABLE_PICTURES']} as p " 'LEFT JOIN ' $CONFIG['TABLE_ALBUMS'] . ' as a ' 'ON p.aid=a.aid ' 'WHERE 1' $pic_filter;
        
$result cpg_db_query($sql);
        
$nbEnr mysql_fetch_array($result);
        
$hit_count = (int)$nbEnr[0];
        
mysql_free_result($result);

        
$sql "SELECT sum(filesize) FROM {$CONFIG['TABLE_PICTURES']} as p " 'LEFT JOIN ' $CONFIG['TABLE_ALBUMS'] . ' as a ' 'ON p.aid=a.aid ' 'WHERE 1' $pic_filter;
        
$result cpg_db_query($sql);
        
$nbEnr mysql_fetch_array($result);
        
$size_count = (int)$nbEnr[0];
        
mysql_free_result($result);

echo 
"<tr><td>Albs:"$album_count." - Pics:".$picture_count." - Comments:".$comment_count." - Cats:".$cat_count." - Hits:".$hit_count." - Filesize:"round ($size_count  / (1024*1024), 2). " MB</td></tr>";
}
endtable();

?>

pelhrimak

IN MB no bytes ...
index.php
find

        $sql = "SELECT sum(hits) FROM {$CONFIG['TABLE_PICTURES']} as p " . 'LEFT JOIN ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'ON p.aid=a.aid ' . 'WHERE 1' . $pic_filter;
        $result = cpg_db_query($sql);
        $nbEnr = mysql_fetch_array($result);
        $hit_count = (int)$nbEnr[0];
        mysql_free_result($result);

        if (count($cat_data)) {
            $statistics = strtr($lang_list_categories['stat1'], array('[pictures]' => $picture_count,
                    '[albums]' => $album_count,
                    '[cat]' => $cat_count,
                    '[comments]' => $comment_count,
                    '[views]' => $hit_count));
        } else {



replace with
                $sql = "SELECT sum(hits) FROM {$CONFIG['TABLE_PICTURES']} as p " . 'LEFT JOIN ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'ON p.aid=a.aid ' . 'WHERE 1' . $pic_filter;
        $result = cpg_db_query($sql);
        $nbEnr = mysql_fetch_array($result);
        $hit_count = (int)$nbEnr[0];
        mysql_free_result($result);

        $sql = "SELECT sum(filesize) FROM {$CONFIG['TABLE_PICTURES']} as p " . 'LEFT JOIN ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'ON p.aid=a.aid ' . 'WHERE 1' . $pic_filter;
        $result = cpg_db_query($sql);
        $nbEnr = mysql_fetch_array($result);
        $size_count = (int)$nbEnr[0];
        mysql_free_result($result);


        if (count($cat_data)) {
            $statistics = strtr($lang_list_categories['stat1'], array('[pictures]' => $picture_count,
                    '[albums]' => $album_count,
                    '[cat]' => $cat_count,
                    '[comments]' => $comment_count,
                    '[size]' => round ($size_count  / (1024*1024), 2),
                    '[views]' => $hit_count));
        } else {


in lang/english.php (or the language file your using) find $lang_list_categories, few lines below replace the line starting with
  'stat1' with
  'stat1' => '<b>[pictures]</b> files in <b>[albums]</b> albums and <b>[cat]</b> categories with <b>[comments]</b> comments viewed <b>[views]</b> times, size <b>[size]</b>k',