C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\4images\admin\stats.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: images.php                                           *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.1                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$nozip 1;
define('IN_CP'1);
define('ROOT_PATH''./../');
require(
'admin_global.php');

if (
$action == "") {
  
$action "resetstats";
}

show_admin_header();

if (
$action == "updatestats") {
  
$cat_id intval($HTTP_POST_VARS['cat_id']);
  
$cat_hits trim($HTTP_POST_VARS['cat_hits']);
  
$image_hits trim($HTTP_POST_VARS['image_hits']);
  
$image_downloads trim($HTTP_POST_VARS['image_downloads']);
  
$image_rating trim($HTTP_POST_VARS['image_rating']);
  
$image_votes trim($HTTP_POST_VARS['image_votes']);
  
  
$where_sql = ($cat_id) ? " WHERE cat_id = $cat_id"";

  echo 
"<b>".$lang['nav_categories_edit']."</b><br />";
  if (
$cat_hits !== "") {
    echo 
$lang['field_hits']."...";
    
flush();

    
$sql "UPDATE ".CATEGORIES_TABLE.
            SET cat_hits = 
$cat_hits
            
$where_sql";
    
$result $site_db->query($sql);

    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();

    
$sql "UPDATE ".IMAGES_TABLE."
            SET image_hits = 
$image_hits
            
$where_sql";
    
$result $site_db->query($sql);

    echo (
$result) ? "<b>OK</b><br />" "<b><span class=\"marktext\">ERROR</span></b><br />";
  }
  if (
$image_downloads !== "") {
    echo 
$lang['field_downloads']."...";
    
flush();

    
$sql "UPDATE ".IMAGES_TABLE."
            SET image_downloads = 
$image_downloads
            
$where_sql";
    
$result $site_db->query($sql);

    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));

    
$sql "UPDATE ".IMAGES_TABLE.
            SET image_rating = 
$image_rating
            
$where_sql";
    
$result $site_db->query($sql);

    echo (
$result) ? "<b>OK</b><br />" "<b><span class=\"marktext\">ERROR</span></b><br />";
  }
  if (
$image_votes !== "") {
    echo 
$lang['field_votes']."...";
    
flush();

    
$sql "UPDATE ".IMAGES_TABLE."
            SET image_votes = 
$image_votes
            
$where_sql";
    
$result $site_db->query($sql);

    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_cat_select_row($lang['field_category'], 02);
  
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();
?>