forked from poppyred/1.6.x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
miniadmin.proxy.keywords.php
executable file
·146 lines (117 loc) · 4.38 KB
/
miniadmin.proxy.keywords.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
session_start();
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
ini_set('error_prepend_string',"<p class='text-error'>");
ini_set('error_append_string',"</p>");
$_SESSION["MINIADM"]=true;
include_once(dirname(__FILE__)."/ressources/class.templates.inc");
include_once(dirname(__FILE__)."/ressources/class.user.inc");
include_once(dirname(__FILE__)."/ressources/class.users.menus.inc");
include_once(dirname(__FILE__)."/ressources/class.miniadm.inc");
include_once(dirname(__FILE__).'/ressources/class.system.network.inc');
if(isset($_GET["verbose"])){$GLOBALS["DEBUG_PRIVS"]=true;$GLOBALS["VERBOSE"]=true;ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);}
if(!isset($_SESSION["uid"])){writelogs("Redirecto to miniadm.logon.php...","NULL",__FILE__,__LINE__);header("location:miniadm.logon.php");}
BuildSessionAuth();
if($_SESSION["uid"]=="-100"){writelogs("Redirecto to location:admin.index.php...","NULL",__FILE__,__LINE__);header("location:admin.index.php");die();}
$users=new usersMenus();
if(!$users->AsProxyMonitor){senderrors("Access denied");}
if(isset($_GET["maintenant"])){maintenant();exit;}
if(isset($_GET["today"])){today();exit;}
if(isset($_GET["search-today"])){today_search();exit;}
if(isset($_GET["search"])){search();exit;}
page();
function page(){
$page=CurrentPageName();
$q=new mysql_squid_builder();
$array["{now}"]="$page?maintenant=yes";
$array["{today}"]="$page?today=yes";
$boot=new boostrap_form();
echo $boot->build_tab($array);
}
function maintenant(){
$boot=new boostrap_form();
echo $boot->SearchFormGen("uid,ipaddr,sitename,words","search");
}
function today(){
$boot=new boostrap_form();
echo $boot->SearchFormGen("uid,ipaddr,sitename,words","search-today");
}
function search(){
$now=date("YmdH");
$tablename="searchwords_$now";
$q=new mysql_squid_builder();
if(!$q->TABLE_EXISTS($tablename)){senderror("$tablename no such table");}
$tpl=new templates();
$search=string_to_flexquery("search");
if (isset($_POST['rp'])) {$rp = $_POST['rp'];}
$sql="SELECT * FROM $tablename WHERE 1 $search ORDER BY zDate DESC LIMIT 0,500";
$results = $q->QUERY_SQL($sql);
if(!$q->ok){senderror($q->mysql_error);}
while ($ligne = mysql_fetch_assoc($results)) {
//$ligne["words"]=utf8_decode($ligne["words"]);
$time=strtotime($ligne["zDate"]);
$ligne["zDate"]=date("H:i:s",$time);
$tr[]="
<tr>
<td nowrap><i class='icon-time' ></i> {$ligne["zDate"]}</a></td>
<td nowrap><i class='icon-user'></i> {$ligne["uid"]}</a></td>
<td>{$ligne["ipaddr"]}</a></td>
<td>{$ligne["words"]}</td>
<td><i class='icon-info-globe'></i> {$ligne["sitename"]}</td>
<td nowrap><i class='icon-info-globe'></i> {$ligne["familysite"]}</td>
</tr>";
}
echo $tpl->_ENGINE_parse_body("
<table class='table table-bordered table-hover'>
<thead>
<tr>
<th>{date}</th>
<th>{member}</th>
<th>{ipaddr}</th>
<th>{words}</th>
<th colspan=2>{sitename}</th>
</tr>
</thead>
<tbody>
").@implode("", $tr)."</tbody></table>";
}
function today_search(){
$now=date("Ymd");
$tablename="searchwordsD_$now";
$q=new mysql_squid_builder();
if(!$q->TABLE_EXISTS($tablename)){senderror("$tablename no such table");}
$tpl=new templates();
$search=string_to_flexquery("search-today");
if (isset($_POST['rp'])) {$rp = $_POST['rp'];}
$sql="SELECT * FROM $tablename WHERE 1 $search ORDER BY `hour` DESC LIMIT 0,500";
$results = $q->QUERY_SQL($sql);
if(!$q->ok){senderror($q->mysql_error);}
while ($ligne = mysql_fetch_assoc($results)) {
$ligne["words"]=utf8_decode($ligne["words"]);
$time=strtotime($ligne["zDate"]);
$ligne["zDate"]=date("H:i:s",$time);
$tr[]="
<tr>
<td nowrap><i class='icon-time' ></i> {$ligne["hour"]}h</a></td>
<td nowrap><i class='icon-user'></i> {$ligne["uid"]}</a></td>
<td>{$ligne["ipaddr"]}</a></td>
<td>{$ligne["words"]}</td>
<td><i class='icon-info-globe'></i> {$ligne["sitename"]}</td>
<td nowrap><i class='icon-info-globe'></i> {$ligne["familysite"]}</td>
</tr>";
}
echo $tpl->_ENGINE_parse_body("
<table class='table table-bordered table-hover'>
<thead>
<tr>
<th>{date}</th>
<th>{member}</th>
<th>{ipaddr}</th>
<th>{words}</th>
<th colspan=2>{sitename}</th>
</tr>
</thead>
<tbody>
").@implode("", $tr)."</tbody></table>";
}