Repository navigation
Expand file tree
/
Copy pathadmin_stats.php
More file actions
executable file
·190 lines (171 loc) · 6.33 KB
/
Copy pathadmin_stats.php
File metadata and controls
executable file
·190 lines (171 loc) · 6.33 KB
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
<?php
/**
*
* Duhok Forum 3.0
* @author Dilovan Matini (original founder)
* @copyright 2007 - 2021 Dilovan Matini
* @see df.lelav.com
* @see https://github.com/dilovanmatini/duhok-forum
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT ANY WARRANTY;
*
*/
const _df_script = "admin_stats";
const _df_filename = "admin_stats.php";
define('_df_path', dirname(__FILE__)."/");
require_once _df_path."globals.php";
$Template->header();
if(ulv == 4){
//*********** start page ****************************************
if(type == ""){
echo'
<table class="border" width="80%" cellSpacing="1" cellPadding="4" align="center" border="0">
<tr>
<td class="menuOptions" colSpan="7">خيارات ادارية</td>
</tr>
<form method="post" action="admin_stats.php?type=show">
<input name="step" value="forums" type="hidden">
<tr>
<td class="asFixedB"><nobr><b>إحصائيات منتدى معين :</b></nobr></td>
<td class="asNormalB">رقم المنتدى : <input type="text" name="frm" size="7"> </td>
<td class="asNormalB">النوع :
<select name="type">
<option value="posts">الردود</option>
</select>
</td>
<td class="asNormalB">عدد النتائج :
<select name="max">
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
<option value="50">50</option>
<option value="60">60</option>
<option value="70">70</option>
<option value="80">80</option>
<option value="90">90</option>
<option value="100">100</option>
<option value="125">125</option>
<option value="150">150</option>
<option value="175">175</option>
<option value="200">200</option>
</select> </td>
<td class="asNormalB">الإحصائيات :
<select name="time">
<option value="day">يومية</option>
<option value="week">أسبوعية</option>
<option value="mounth">شهرية</option>
<option value="year">سنوية</option>
</select> </td>
<td class="asNormalB">
<input class="button" type="submit" value="إظهار الإحصائيات"></td>
</tr>
</form>
<form method="post" action="admin_stats.php?type=show">
<input name="step" value="all" type="hidden">
<tr>
<td class="asFixedB" colSpan="2"><nobr><b>إحصائيات المنتدى بأسره :</b></nobr></td>
<td class="asNormalB">النوع :
<select name="type">
<option value="posts">الردود</option>
</select>
</td>
<td class="asNormalB">عدد النتائج :
<select name="max">
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
<option value="50">50</option>
<option value="60">60</option>
<option value="70">70</option>
<option value="80">80</option>
<option value="90">90</option>
<option value="100">100</option>
<option value="125">125</option>
<option value="150">150</option>
<option value="175">175</option>
<option value="200">200</option>
</select> </td>
<td class="asNormalB">الإحصائيات :
<select name="time">
<option value="day">يومية</option>
<option value="week">أسبوعية</option>
<option value="mounth">شهرية</option>
<option value="year">سنوية</option>
</select> </td>
<td class="asNormalB">
<input class="button" type="submit" value="إظهار الإحصائيات"></td>
</tr>
</form>
</table>';
}
elseif(type == "show"){
$step=$_POST['step'];
$frm= intval($_POST['frm']);
$types=$_POST['type'];
$max=$_POST['max'];
$time=$_POST['time'];
if($time == "day"){
$thetime = time()." - ".(60 * 60 * 24);
$add_title = "اليومية";
}elseif($time == "week"){
$thetime = time()." - ".(60 * 60 * 24 * 7);
$add_title = "الأسبوعية";
}elseif($time == "mounth"){
$thetime = time()." - ".(60 * 60 * 24 * 30);
$add_title = "الشهرية";
}elseif($time == "year"){
$thetime = time()." - ".(60 * 60 * 24 * 356);
$add_title = "السنوية";
}
if($step == "forums"){
if($frm <= 0){
$Template->errMsg("يجب أن تدخل رقما صحيحا للمنتدى");
}
$title_first = "إحصائيات المنتدى رقم : $frm";
if($types == "posts"){
$type_show = "الردود";
$sql =$mysql->query("SELECT COUNT(post.id) AS counts, member.name,member.id FROM ".prefix."user AS member LEFT JOIN ".prefix."post AS post ON (post.author = member.id) WHERE post.forumid = '".$frm."' and post.date > $thetime GROUP BY post.author ORDER BY counts DESC LIMIT $max", __FILE__, __LINE__);
}elseif($types == "topics"){
$type_show = "المواضيع";
$sql =$mysql->query("SELECT COUNT(post.id) AS counts, member.name,member.id FROM ".prefix."user AS member LEFT JOIN ".prefix."topicusers AS post ON (post.userid = member.id) WHERE post.forumid = '".$frm."' and post.adddate > $thetime GROUP BY post.userid ORDER BY counts DESC LIMIT $max", __FILE__, __LINE__);
}
}
if($step == "all"){
$title_first = "إحصائيات المنتدى";
$type_show = "الردود";
$sql =$mysql->query("SELECT COUNT(post.id) AS counts, member.name,member.id FROM ".prefix."user AS member LEFT JOIN ".prefix."post AS post ON (post.author = member.id) WHERE post.date > $thetime GROUP BY post.author ORDER BY counts DESC LIMIT $max", __FILE__, __LINE__);
}
echo"
<input type=\"hidden\" name=\"type\">
<table id=\"myTable\" width=\"40%\" cellpadding=\"4\" cellspacing=\"2\" align=\"center\" border=\"0\">
<tr>
<td class=\"asHeader\" colspan=\"7\">$title_first - ($add_title) - <font color=\"red\">$type_show</td>
</tr>
<tr>
<td class=\"asDarkB\" width=\"10%\" ><nobr> </nobr></td>
<td class=\"asDarkB\"><nobr><b>اسم العضوية</b></nobr></td>
<td class=\"asDarkB\" width=\"10%\" ><nobr><b>المشاركات</b></nobr></td>
</tr>";
$i=1;
while($r = $mysql->fetchArray($sql)){
echo"
<tr>
<td class=\"asNormalB\">".$i."</td>
<td class=\"asNormalB\" align=\"center\">".$r['name']."</td>
<td class=\"asNormalB\">".$r['counts']."</td>
</tr>";
$i++;
}
echo"
</tr>
</table>";
}
//*********** end page ****************************************
}
else{
$DF->goTo();
}
$Template->footer();
?>