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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
|
<?php /************************************************************************** * * * 4images - A Web Based Image Gallery Management System * * ---------------------------------------------------------------- * * * * File: home.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. * * * *************************************************************************/
$stats_limit = 5;
define('IN_CP', 1); define('ROOT_PATH', './../'); require('admin_global.php');
if ($action == "") { $action = "home"; }
show_admin_header();
$ip_whois_link = "http://www.ripe.net/perl/whois/?searchtext=";
if ($action == "home") { if (!defined('USER_INTEGRATION')) { printf("<span class=\"headline\">%s</span><br /><br />", $lang['headline_whosonline']); echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr><td class=\"tableborder\">\n<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n"; echo "<tr class=\"tableseparator\">\n"; echo "<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_lastaction']."</td>\n<td class=\"tableseparator\"> </td>\n<td class=\"tableseparator\">".$lang['field_ip']."</td>\n</tr>\n";
$num_total_online = 0; $num_visible_online = 0; $num_invisible_online = 0; $num_registered_online = 0; $num_guests_online = 0; $user_online_list = ""; $prev_user_id = ""; $prev_ip = "";
$sql = "SELECT ".get_user_table_field("u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_location").get_user_table_field(", u.", "user_invisible").", s.session_user_id, s.session_lastaction, s.session_ip FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s WHERE ".get_user_table_field("u.", "user_id")." = s.session_user_id AND s.session_user_id <> ".GUEST." AND ".get_user_table_field("u.", "user_lastaction")." > ".(time() - 300)." ORDER BY session_ip ASC"; $result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result)) { if ($row['session_user_id'] != $prev_user_id) { echo "<tr class=\"".get_row_bg()."\">\n"; $user_id = $row['session_user_id']; $username = $row[$user_table_fields['user_name']];
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 1 : 0; if ($is_invisible) { // Invisible User but show to Admin $invisibleuser = "*"; } else { $invisibleuser = ""; $num_visible_online++; } if ($row[$user_table_fields['user_level']] == ADMIN) { $username = sprintf("<b>%s</b>", $username); } if (empty($user_profile_link)) { $username = "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$user_id)."\" target=\"_blank\">".$username."</a>"; } echo "<td>".$username.$invisibleuser."</td>\n"; echo "<td>".format_date($config['date_format']." ".$config['time_format'], $row[$user_table_fields['user_lastaction']])."</td>\n";
if (eregi("Control Panel", $row[$user_table_fields['user_location']])) { echo "<td>Control Panel</td>"; } else { echo "<td><a href=\"".$site_sess->url(ROOT_PATH.$row[$user_table_fields['user_location']])."\" target=\"_blank\">".$row[$user_table_fields['user_location']]."</a></td>\n"; } echo "<td><a href=\"".$ip_whois_link.$row['session_ip']."\" target=\"_blank\">".$row['session_ip']."</a></td>\n"; $num_registered_online++; } $prev_user_id = $row['session_user_id']; }
$sql = "SELECT session_user_id, session_lastaction, session_ip, session_location FROM ".SESSIONS_TABLE." WHERE session_lastaction >= ".(time() - 300)." AND session_user_id = ".GUEST; $result = $site_db->query($sql);
$num_guests_online = 0; while ($row = $site_db->fetch_array($result)) { if ($row['session_ip'] != $prev_ip) { echo "<tr class=\"".get_row_bg()."\">\n"; echo "<td>".$lang['userlevel_guest']."</td>\n"; echo "<td>".format_date($config['date_format']." ".$config['time_format'], $row['session_lastaction'])."</td>\n"; if (eregi("Control Panel", $row['session_location'])) { echo "<td>Control Panel</td>"; } else { echo "<td><a href=\"".$site_sess->url(ROOT_PATH.$row['session_location'])."\" target=\"_blank\">".$row['session_location']."</a></td>\n"; } echo "<td>".$row['session_ip']."</td>\n"; echo "</tr>\n"; $num_guests_online++; } $prev_ip = $row['session_ip']; }
echo "</table></td></tr></table><br />"; $num_total_online = $num_registered_online + $num_guests_online; $num_invisible_online = $num_registered_online - $num_visible_online;
$lang['online_users'] = preg_replace("/".$site_template->start."num_total".$site_template->end."/siU", $num_total_online, $lang['online_users']); $lang['online_users'] = preg_replace("/".$site_template->start."num_registered".$site_template->end."/siU", $num_registered_online, $lang['online_users']); $lang['online_users'] = preg_replace("/".$site_template->start."num_guests".$site_template->end."/siU", $num_guests_online, $lang['online_users']); printf ("<b>%s</b><br /><br /><br />", $lang['online_users']); } // End defined('USER_INTEGRATION')
$total_images = 0; $total_categories = 0; foreach ($cat_cache as $val) { $total_categories++; if (isset($val['num_images'])) { $total_images += $val['num_images']; } }
printf("<span class=\"headline\">%s</span><br /><br />", $lang['headline_stats']);
show_table_header($lang['nav_general_main'], 4);
//1 echo "<tr class=\"".get_row_bg()."\">\n"; echo "<td width=\"16%\"><b>".$lang['categories']."</b></td><td width=\"16%\">".$total_categories."</td>\n"; $size = 0; echo "<td width=\"16%\"><b>".$lang['media_directory']."</b></td><td width=\"16%\">".format_file_size(get_dir_size(MEDIA_PATH))."</td>\n"; echo "</tr>";
//2 echo "<tr class=\"".get_row_bg()."\">\n";
$sql = "SELECT COUNT(*) as temp_images FROM ".IMAGES_TEMP_TABLE; $row = $site_db->query_firstrow($sql);
$awaiting_validation = preg_replace("/".$site_template->start."num_images".$site_template->end."/siU", $row['temp_images'], $lang['images_awaiting_validation']); $awaiting_validation = sprintf("<a href=\"".$site_sess->url("validateimages.php?action=validateimages")."\">%s</a>", $awaiting_validation); echo "<td width=\"16%\"><b>".$lang['images']."</b></td><td width=\"16%\">".$total_images." / ".$awaiting_validation."</td>\n"; $size = 0; echo "<td width=\"16%\"><b>".$lang['thumb_directory']."</b></td><td width=\"16%\">".format_file_size(get_dir_size(THUMB_PATH))."</td>\n"; echo "</tr>";
//3 echo "<tr class=\"".get_row_bg()."\">\n";
$sql = "SELECT COUNT(*) as users FROM ".USERS_TABLE." WHERE ".get_user_table_field("", "user_id")." <> ".GUEST; $row = $site_db->query_firstrow($sql);
echo "<td width=\"16%\"><b>".$lang['users']."</b></td><td width=\"16%\">".$row['users']."</td>\n";
echo "<td width=\"16%\"><b>".$lang['database']."</b></td><td width=\"16%\">"; include(ROOT_PATH.'includes/db_utils.php'); get_database_size(); if (!empty($global_info['database_size']['total'])) { if (!empty($global_info['database_size']['4images'])) { $db_status = $lang['homestats_total']." <b>".format_file_size($global_info['database_size']['total'])."</b> / "; $db_status .= "4images: <b>".format_file_size($global_info['database_size']['4images'])."</b>"; } else { $db_status = format_file_size(!empty($global_info['database_size']['total'])); } } else { $db_status = "n/a"; }
echo $db_status."</td>\n";
echo "</tr>"; show_table_footer();
$sql = "SELECT SUM(cat_hits) AS sum FROM ".CATEGORIES_TABLE; $row = $site_db->query_firstrow($sql);
$sum = (isset($row['sum'])) ? $row['sum'] : 0; show_table_header($lang['top_cat_hits']." (".$lang['homestats_total']." ".$sum.")", 4);
$sql = "SELECT cat_id, cat_name, cat_hits FROM ".CATEGORIES_TABLE." ORDER BY cat_hits DESC LIMIT $stats_limit"; $result = $site_db->query($sql);
$num = 1; while ($row = $site_db->fetch_array($result)) { if ($num == 1) { $max = $row['cat_hits']; if ($max == 0) { $max = 1; } } echo "<tr class=\"".get_row_bg()."\">\n"; echo "<td> ".$num.".</td>\n<td nowrap=\"nowrap\"><b><a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$row['cat_id'])."\" target=\"_blank\">".$row['cat_name']."</a></b></td>\n\n"; $per = intval($row['cat_hits'] / $max * 100); echo "<td width=\"100%\">\n"; echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\"><tr><td bgcolor=\"#FFFFFF\">\n"; echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$per."%\"><tr>\n"; echo "<td bgcolor=\"#FCDC43\"><img src=\"images/spacer.gif\" height=\"10\" width=\"2\"></td>\n"; echo "</tr></table></td></tr></table>\n</td>"; echo "<td align=\"center\">".$row['cat_hits']."</td></tr>\n"; $num++; } if ($num == 1) { echo "<tr class=\"".get_row_bg()."\">\n<td colspan=\"4\">".$lang['no_search_results']."</td></tr>"; }
$sql = "SELECT SUM(image_hits) AS sum FROM ".IMAGES_TABLE; $row = $site_db->query_firstrow($sql);
$sum = (isset($row['sum'])) ? $row['sum'] : 0; show_table_separator($lang['top_image_hits']." (".$lang['homestats_total']." ".$sum.")", 4);
$sql = "SELECT image_id, image_name, image_hits FROM ".IMAGES_TABLE." ORDER BY image_hits DESC LIMIT $stats_limit"; $result = $site_db->query($sql);
$num = 1; while ($row = $site_db->fetch_array($result)) { if ($num == 1) { $max = $row['image_hits']; if ($max == 0) { $max = 1; } } echo "<tr class=\"".get_row_bg()."\">\n"; echo "<td> ".$num.".</td>\n<td nowrap=\"nowrap\"><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\" target=\"_blank\">".$row['image_name']."</a></b></td>\n\n"; $per = intval($row['image_hits'] / $max * 100); echo "<td width=\"100%\">\n"; echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\"><tr><td bgcolor=\"#FFFFFF\">\n"; echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$per."%\"><tr>\n"; echo "<td bgcolor=\"#FCDC43\"><img src=\"images/spacer.gif\" height=\"10\" width=\"2\"></td>\n"; echo "</tr></table></td></tr></table>\n</td>"; echo "<td align=\"center\">".$row['image_hits']."</td></tr>\n"; $num++; } if ($num == 1) { echo "<tr class=\"".get_row_bg()."\">\n<td colspan=\"4\">".$lang['no_search_results']."</td></tr>"; }
show_table_separator($lang['top_image_rating'], 4);
$sql = "SELECT image_id, image_name, image_rating FROM ".IMAGES_TABLE." ORDER BY image_rating DESC LIMIT $stats_limit"; $result = $site_db->query($sql);
$num = 1; while ($row = $site_db->fetch_array($result)) { if ($num == 1) { $max = $row['image_rating']; if ($max == 0) { $max = 1; } } echo "<tr class=\"".get_row_bg()."\">\n"; echo "<td> ".$num.".</td>\n<td nowrap=\"nowrap\"><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\" target=\"_blank\">".$row['image_name']."</a></b></td>\n\n"; $per = intval($row['image_rating'] / $max * 100); echo "<td width=\"100%\">\n"; echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\"><tr><td bgcolor=\"#FFFFFF\">\n"; echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$per."%\"><tr>\n"; echo "<td bgcolor=\"#FCDC43\"><img src=\"images/spacer.gif\" height=\"10\" width=\"2\"></td>\n"; echo "</tr></table></td></tr></table>\n</td>"; echo "<td align=\"center\">".$row['image_rating']."</td></tr>\n"; $num++; } if ($num == 1) { echo "<tr class=\"".get_row_bg()."\">\n<td colspan=\"4\">".$lang['no_search_results']."</td></tr>"; }
$sql = "SELECT SUM(image_votes) AS sum FROM ".IMAGES_TABLE; $row = $site_db->query_firstrow($sql);
$sum = (isset($row['sum'])) ? $row['sum'] : 0; show_table_separator($lang['top_image_votes']." (".$lang['homestats_total']." ".$sum.")", 4);
$sql = "SELECT image_id, image_name, image_votes FROM ".IMAGES_TABLE." ORDER BY image_votes DESC LIMIT $stats_limit"; $result = $site_db->query($sql);
$num = 1; while ($row = $site_db->fetch_array($result)) { if ($num == 1) { $max = $row['image_votes']; if ($max == 0) { $max = 1; } } echo "<tr class=\"".get_row_bg()."\">\n"; echo "<td> ".$num.".</td>\n<td nowrap=\"nowrap\"><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\" target=\"_blank\">".$row['image_name']."</a></b></td>\n\n"; $per = intval($row['image_votes'] / $max * 100); echo "<td width=\"100%\">\n"; echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\"><tr><td bgcolor=\"#FFFFFF\">\n"; echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$per."%\"><tr>\n"; echo "<td bgcolor=\"#FCDC43\"><img src=\"images/spacer.gif\" height=\"10\" width=\"2\"></td>\n"; echo "</tr></table></td></tr></table>\n</td>"; echo "<td align=\"center\">".$row['image_votes']."</td></tr>\n"; $num++; } if ($num == 1) { echo "<tr class=\"".get_row_bg()."\">\n<td colspan=\"4\">".$lang['no_search_results']."</td></tr>"; }
$sql = "SELECT SUM(image_downloads) AS sum FROM ".IMAGES_TABLE; $row = $site_db->query_firstrow($sql);
$sum = (isset($row['sum'])) ? $row['sum'] : 0; show_table_separator($lang['top_image_downloads']." (".$lang['homestats_total']." ".$sum.")", 4);
$sql = "SELECT image_id, image_name, image_downloads FROM ".IMAGES_TABLE." ORDER BY image_downloads DESC LIMIT $stats_limit"; $result = $site_db->query($sql);
$num = 1; while ($row = $site_db->fetch_array($result)) { if ($num == 1) { $max = $row['image_downloads']; if ($max == 0) { $max = 1; } } echo "<tr class=\"".get_row_bg()."\">\n"; echo "<td> ".$num.".</td>\n<td nowrap=\"nowrap\"><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\" target=\"_blank\">".$row['image_name']."</a></b></td>\n\n"; $per = intval($row['image_downloads'] / $max * 100); echo "<td width=\"100%\">\n"; echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\"><tr><td bgcolor=\"#FFFFFF\">\n"; echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$per."%\"><tr>\n"; echo "<td bgcolor=\"#FCDC43\"><img src=\"images/spacer.gif\" height=\"10\" width=\"2\"></td>\n"; echo "</tr></table></td></tr></table>\n</td>"; echo "<td align=\"center\">".$row['image_downloads']."</td></tr>\n"; $num++; } if ($num == 1) { echo "<tr class=\"".get_row_bg()."\">\n<td colspan=\"4\">".$lang['no_search_results']."</td></tr>"; }
show_table_footer(); } show_admin_footer(); ?>
|