new code for: your domain/gallery/admin/stats.php
stats.php
<?php
define('IN_CP', 1);
define('ROOT_PATH', './../');
require('admin_global.php');
if ($action == "") {
$action = "resetstats";
}
show_admin_header();
if ($action == "updatestats") {
$cat_hits = intval($HTTP_POST_VARS['cat_hits']);
$image_hits = intval($HTTP_POST_VARS['image_hits']);
$image_downloads = intval($HTTP_POST_VARS['image_downloads']);
$image_rating = trim($HTTP_POST_VARS['image_rating']);
$image_votes = intval($HTTP_POST_VARS['image_votes']);
echo "<b>".$lang['nav_categories_edit']."</b><br />";
if ($cat_hits != "") {
echo $lang['field_hits']."...";
flush();
$result = $site_db->query("UPDATE ".CATEGORIES_TABLE."
SET cat_hits = $cat_hits");
echo ($result) ? "<b>OK</b><br />" : "<b><span class=\"marktext\">ERROR</span></b><br />";
}
echo "<br /><br /><b>".$lang['nav_images_edit']."</b><br />";
if ($image_hits != "") {
echo $lang['field_hits']."...";
flush();
$result = $site_db->query("UPDATE ".IMAGES_TABLE."
SET image_hits = $image_hits");
echo ($result) ? "<b>OK</b><br />" : "<b><span class=\"marktext\">ERROR</span></b><br />";
}
if ($image_downloads != "") {
echo $lang['field_downloads']."...";
flush();
$result = $site_db->query("UPDATE ".IMAGES_TABLE."
SET image_downloads = $image_downloads");
echo ($result) ? "<b>OK</b><br />" : "<b><span class=\"marktext\">ERROR</span></b><br />";
}
if ($image_rating != "") {
echo $lang['field_rating']."...";
flush();
$image_rating = sprintf("%.2f", intval($image_rating));
$result = $site_db->query("UPDATE ".IMAGES_TABLE."
SET image_rating = $image_rating");
echo ($result) ? "<b>OK</b><br />" : "<b><span class=\"marktext\">ERROR</span></b><br />";
}
if ($image_votes != "") {
echo $lang['field_votes']."...";
flush();
$result = $site_db->query("UPDATE ".IMAGES_TABLE."
SET image_votes = $image_votes");
echo ($result) ? "<b>OK</b><br />" : "<b><span class=\"marktext\">ERROR</span></b><br />";
}
}
if ($action == "resetstats") {
if ($msg != "") {
printf("<b>%s</b>\n", $msg);
}
show_form_header("stats.php", "updatestats", "form", 1);
show_table_header($lang['nav_general_stats'], 2);
show_description_row($lang['reset_stats_desc'], 2);
show_table_separator($lang['nav_categories_edit'], 2);
show_input_row($lang['field_hits'], "cat_hits", "", $textinput_size2);
show_table_separator($lang['nav_images_edit'], 2);
show_input_row($lang['field_hits'], "image_hits", "", $textinput_size2);
show_input_row($lang['field_downloads'], "image_downloads", "", $textinput_size2);
show_input_row($lang['field_rating']." (1-".MAX_RATING.")", "image_rating", "", $textinput_size2);
show_input_row($lang['field_votes'], "image_votes", "", $textinput_size2);
show_form_footer($lang['save_changes'], "", 2);
}
show_admin_footer();
?>