6 |
kaklik |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/************************************************************************/
|
|
|
4 |
/* G-Shout : Gravitasi Shoutbox */
|
|
|
5 |
/* ============================================ */
|
|
|
6 |
/* */
|
|
|
7 |
/* Copyright (c) 2005 by Yohanes Pradono */
|
|
|
8 |
/* http://gravitasi.com */
|
|
|
9 |
/* */
|
|
|
10 |
/* This program is free software. You can redistribute it and/or modify */
|
|
|
11 |
/* it under the terms of the GNU General Public License as published by */
|
|
|
12 |
/* the Free Software Foundation; either version 2 of the License. */
|
|
|
13 |
/* */
|
|
|
14 |
/************************************************************************/
|
|
|
15 |
|
|
|
16 |
if(is_file("install.php")){
|
|
|
17 |
die("WARNING!!! You must delete install.php before using G-Shout");
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
header("Expires: Sun, 10 Jan 1982 05:00:00 GMT"); // donie's birthday
|
|
|
21 |
header("Last-Modified: ".gmdate("D, d M Y H:i:s"). " GMT"); // always modified
|
|
|
22 |
if($SERVER_PROTOCOL == "HTTP/1.0"){
|
|
|
23 |
header("Pragma: no-cache"); // HTTP/1.0
|
|
|
24 |
}else{
|
|
|
25 |
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
include("config.php");
|
|
|
29 |
include("./includes/functions.inc.php");
|
|
|
30 |
include("./languages/lang-".$language.".php");
|
|
|
31 |
|
|
|
32 |
if(validCookie($_COOKIE['gshout_auth'])){
|
|
|
33 |
|
|
|
34 |
if(!is_writable($datafile)){
|
|
|
35 |
$error = _DATA_UNWRITABLE;
|
|
|
36 |
} else if (!is_writable("config.php")){
|
|
|
37 |
$error = _CONF_UNWRITABLE;
|
|
|
38 |
} else if (!is_writable($logfile)){
|
|
|
39 |
$error = _LOG_UNWRITABLE;
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
if ($_POST['action'] == "logfilter" AND validCookie($_COOKIE['gshout_auth'])) {
|
|
|
43 |
$fp = fopen("config.php","r");
|
|
|
44 |
while (!feof($fp)){
|
|
|
45 |
$data = fgets($fp, filesize("config.php"));
|
|
|
46 |
if (substr($data,0,12) == '$logsperpage') {
|
|
|
47 |
$output[] = '$logsperpage = "'.trim($_POST['new_logsperpage'])."\";\n";
|
|
|
48 |
} else {//nothing happened :)
|
|
|
49 |
$output[] = $data;
|
|
|
50 |
}
|
|
|
51 |
}//end while
|
|
|
52 |
fclose($fp);
|
|
|
53 |
$fp = fopen("config.php","w");
|
|
|
54 |
if($fp){
|
|
|
55 |
foreach ($output as $data){
|
|
|
56 |
fwrite ($fp, $data);
|
|
|
57 |
}
|
|
|
58 |
} else {
|
|
|
59 |
$error = _ERROR_WRITE_CONF;
|
|
|
60 |
}
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
// re-read the new config file
|
|
|
64 |
include("config.php");
|
|
|
65 |
|
|
|
66 |
// include header
|
|
|
67 |
include("./includes/header.inc.php");
|
|
|
68 |
?>
|
|
|
69 |
|
|
|
70 |
<table style="width: 100%;" border="0" cellpadding="0" cellspacing="0">
|
|
|
71 |
<tbody><tr>
|
|
|
72 |
<td class="navCell" style="width: 2%;">
|
|
|
73 |
|
|
|
74 |
<div class="cpNavOff">
|
|
|
75 |
|
|
|
76 |
</div>
|
|
|
77 |
|
|
|
78 |
</td>
|
|
|
79 |
<td class="navCell">
|
|
|
80 |
|
|
|
81 |
<div class="cpNavOff">
|
|
|
82 |
<a href="admin.php"> <?=_EDIT_SHOUTS;?> </a>
|
|
|
83 |
</div>
|
|
|
84 |
|
|
|
85 |
</td>
|
|
|
86 |
|
|
|
87 |
<td class="navCell">
|
|
|
88 |
|
|
|
89 |
<div class="cpNavOff">
|
|
|
90 |
<a href="editconf.php"> <?=_CONFIGURATION;?> </a>
|
|
|
91 |
</div>
|
|
|
92 |
|
|
|
93 |
</td>
|
|
|
94 |
|
|
|
95 |
<td class="navCell">
|
|
|
96 |
|
|
|
97 |
<div class="cpNavOn">
|
|
|
98 |
<a href="logs.php"> <?=_VIEW_LOGS?> </a>
|
|
|
99 |
</div>
|
|
|
100 |
|
|
|
101 |
</td>
|
|
|
102 |
|
|
|
103 |
<td class="navCell" style="width: 2%;">
|
|
|
104 |
|
|
|
105 |
<div class="cpNavOff">
|
|
|
106 |
|
|
|
107 |
</div>
|
|
|
108 |
|
|
|
109 |
</td>
|
|
|
110 |
</tr>
|
|
|
111 |
</tbody></table>
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
<div id="breadcrumb">
|
|
|
116 |
<table style="width: 100%;" class="contentWidth" border="0" cellpadding="6" cellspacing="0">
|
|
|
117 |
<tbody><tr>
|
|
|
118 |
<td class="defaultBold">
|
|
|
119 |
<span class="crumblinks">
|
|
|
120 |
<h2><?=_VIEW_LOGS?></h2>
|
|
|
121 |
</span>
|
|
|
122 |
|
|
|
123 |
</td>
|
|
|
124 |
<td class="breadcrumbRight">
|
|
|
125 |
|
|
|
126 |
</td>
|
|
|
127 |
</tr>
|
|
|
128 |
</tbody></table>
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
</div>
|
|
|
132 |
|
|
|
133 |
<div id="content">
|
|
|
134 |
|
|
|
135 |
<table border='0' cellspacing='0' cellpadding='0' style='width:100%;' >
|
|
|
136 |
<?
|
|
|
137 |
if(isset($_GET['message'])){
|
|
|
138 |
echo "<tr><td class='box' colspan='2'><div class='itemWrapper'>";
|
|
|
139 |
echo "<div class='success'>";
|
|
|
140 |
echo $_GET['message'];
|
|
|
141 |
echo "</div>";
|
|
|
142 |
echo "</div></td></tr>";
|
|
|
143 |
} else if(isset($_GET['error'])) {
|
|
|
144 |
echo "<tr><td class='box' colspan='2'><div class='itemWrapper'>";
|
|
|
145 |
echo "<div class='alert'>".$_GET['error']."</div>";
|
|
|
146 |
echo "</div></td></tr>";
|
|
|
147 |
} else if(isset($message)){
|
|
|
148 |
echo "<tr><td class='box' colspan='2'><div class='itemWrapper'>";
|
|
|
149 |
echo "<div class='success'>";
|
|
|
150 |
echo $message;
|
|
|
151 |
echo "</div>";
|
|
|
152 |
echo "</div></td></tr>";
|
|
|
153 |
} else if(isset($error)) {
|
|
|
154 |
echo "<tr><td class='box' colspan='2'><div class='itemWrapper'>";
|
|
|
155 |
echo "<div class='alert'>".$error."</div>";
|
|
|
156 |
echo "</div></td></tr>";
|
|
|
157 |
} else {
|
|
|
158 |
echo "<tr><td><div class='success'> </div></td></tr>";
|
|
|
159 |
}
|
|
|
160 |
?>
|
|
|
161 |
</table>
|
|
|
162 |
|
|
|
163 |
<table>
|
|
|
164 |
<tr>
|
|
|
165 |
<td class='itemWrapper' colspan='7'>
|
|
|
166 |
|
|
|
167 |
<form method='post' name='filterform' id='filterform' action='logs.php' >
|
|
|
168 |
|
|
|
169 |
<select name='new_logsperpage' class='select'>
|
|
|
170 |
<option value='<?=$logsperpage?>'>Logs per page</option>
|
|
|
171 |
<option value='10' <?if($logsperpage=="10")echo "selected='selected'";?>>10 results</option>
|
|
|
172 |
<option value='25' <?if($logsperpage=="25")echo "selected='selected'";?>>25 results</option>
|
|
|
173 |
<option value='50' <?if($logsperpage=="50")echo "selected='selected'";?>>50 results</option>
|
|
|
174 |
<option value='75' <?if($logsperpage=="75")echo "selected='selected'";?>>75 results</option>
|
|
|
175 |
<option value='100' <?if($logsperpage=="100")echo "selected='selected'";?>>100 results</option>
|
|
|
176 |
</select>
|
|
|
177 |
|
|
|
178 |
<input type='hidden' name='action' value='logfilter' />
|
|
|
179 |
<input type='submit' name='submit' value='Go' class='submit' />
|
|
|
180 |
</form>
|
|
|
181 |
|
|
|
182 |
</td>
|
|
|
183 |
</tr>
|
|
|
184 |
</table>
|
|
|
185 |
|
|
|
186 |
<table border='0' cellspacing='0' cellpadding='0' style='width:100%;' class='tableBorder' >
|
|
|
187 |
|
|
|
188 |
<tr>
|
|
|
189 |
<td class='tablePad' >
|
|
|
190 |
|
|
|
191 |
<table border='0' cellspacing='0' cellpadding='0' style='width:100%;' >
|
|
|
192 |
|
|
|
193 |
<tr>
|
|
|
194 |
<td class='tableHeadingBold' >
|
|
|
195 |
<?=_DATE?>
|
|
|
196 |
</td>
|
|
|
197 |
<td class='tableHeadingBold' >
|
|
|
198 |
<?=_IP_ADDRESS?>
|
|
|
199 |
</td>
|
|
|
200 |
<td class='tableHeadingBold' >
|
|
|
201 |
<?=_ACTION?>
|
|
|
202 |
</td>
|
|
|
203 |
<td class='tableHeadingBold' >
|
|
|
204 |
<?=_VALUE?>
|
|
|
205 |
</td>
|
|
|
206 |
</tr>
|
|
|
207 |
|
|
|
208 |
<?
|
|
|
209 |
//buat menentukan jumlah ditampilkan
|
|
|
210 |
$logcount = countLogs();
|
|
|
211 |
if (!isset($page)||$page==0) {
|
|
|
212 |
$page=1;
|
|
|
213 |
}
|
|
|
214 |
|
|
|
215 |
$entry = ($logsperpage * $page)-$logsperpage;
|
|
|
216 |
$selesai = $logsperpage*$page;
|
|
|
217 |
|
|
|
218 |
if($data = file($logfile)) {
|
|
|
219 |
while ($data[$entry] != "" && $entry < $selesai ) {
|
|
|
220 |
|
|
|
221 |
if($data = file($logfile)) {
|
|
|
222 |
$temporary = explode("#%", $data[$entry]);
|
|
|
223 |
$timestamp = $temporary[0];
|
|
|
224 |
$ip = $temporary[1];
|
|
|
225 |
$action = constant($temporary[2]);
|
|
|
226 |
$value = $temporary[3];
|
|
|
227 |
}
|
|
|
228 |
viewLogs($timestamp,$ip,$action,$value);
|
|
|
229 |
$entry++;
|
|
|
230 |
}
|
|
|
231 |
}
|
|
|
232 |
?>
|
|
|
233 |
|
|
|
234 |
</table>
|
|
|
235 |
|
|
|
236 |
</td>
|
|
|
237 |
|
|
|
238 |
</tr>
|
|
|
239 |
</table>
|
|
|
240 |
|
|
|
241 |
|
|
|
242 |
<div class='itemWrapper'>
|
|
|
243 |
<div class='crumblinks'>
|
|
|
244 |
<!-- Begin paginate -->
|
|
|
245 |
<table class="paginate"><tr><td> <?=_DISPLAYING_PAGE?> <?=$page?> <?=_OF?> <?=floor($logcount/$logsperpage)+1?> (<?=_TOTAL?> <?=$logcount?> <?=_FROM_MAXIMAL?> <?=$lastlogs?> <?=_LAST_LOGS?>)</tr></td><tr><td> <?=_PAGE?>
|
|
|
246 |
<?
|
|
|
247 |
if ($page != 1) {
|
|
|
248 |
echo "<a href='logs.php?page=1'>[ << ]</a> <a href='logs.php?page=".($page-1)."'>[ < ]</a> ";
|
|
|
249 |
} else {
|
|
|
250 |
echo "<font color='#666666'>[ << ] [ < ]</font> ";
|
|
|
251 |
}
|
|
|
252 |
for ($count=0;$count<$logcount;$count=$count+$logsperpage) {
|
|
|
253 |
$newpage = floor($count/$logsperpage) + 1;
|
|
|
254 |
if ($page == $newpage) {
|
|
|
255 |
echo $newpage." ";
|
|
|
256 |
} else {
|
|
|
257 |
echo "<a href='logs.php?page=".$newpage."'>".$newpage."</a> ";
|
|
|
258 |
}
|
|
|
259 |
}
|
|
|
260 |
if ($page != floor($logcount/$logsperpage)+1) {
|
|
|
261 |
echo "<a href='logs.php?page=".($page+1)."'>[ > ]</a> <a href='logs.php?page=".(floor($logcount/$logsperpage)+1)."'>[ >> ]</a>";
|
|
|
262 |
} else {
|
|
|
263 |
echo "<font color='#666666'>[ > ] [ >> ]</font>";
|
|
|
264 |
}
|
|
|
265 |
?>
|
|
|
266 |
</td></tr></table>
|
|
|
267 |
<!-- End of paginate -->
|
|
|
268 |
</div>
|
|
|
269 |
</div>
|
|
|
270 |
|
|
|
271 |
<?
|
|
|
272 |
include("./includes/footer.inc.php");
|
|
|
273 |
} else {
|
|
|
274 |
writeLogs($_SERVER["REMOTE_ADDR"],"_LOG_LOGIN_EXPIRED","");
|
|
|
275 |
header("Location: admin.php?error="._RELOGIN."");
|
|
|
276 |
}
|
|
|
277 |
?>
|