1 | <?php |
---|
2 | //======================================================================================= |
---|
3 | if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); |
---|
4 | switch (strtolower($info_ip)) |
---|
5 | { |
---|
6 | case 'ajout' : |
---|
7 | $ip_black=str_replace("*","%",$ip_black); |
---|
8 | if (!($ip_black == '')) { |
---|
9 | $query = " |
---|
10 | SELECT `ip` |
---|
11 | FROM `".MAIL_BLACK_LISTE_TABLE."` |
---|
12 | WHERE '".$ip_black."' LIKE ip |
---|
13 | ;"; |
---|
14 | //============================================================================== |
---|
15 | list($count) = pwg_db_fetch_row(pwg_query($query)); |
---|
16 | //============================================================================== |
---|
17 | $valeurs=array( 'NULL', |
---|
18 | "'".$ip_black."'", |
---|
19 | "'".$pays."'", |
---|
20 | "'".$region."'", |
---|
21 | "'".$ville."'", |
---|
22 | '"adresse"', |
---|
23 | '"fai" ', |
---|
24 | $count + 1 |
---|
25 | ); |
---|
26 | ajout_ligne(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs, $valeurs,($count==0)) ; |
---|
27 | } |
---|
28 | |
---|
29 | break; |
---|
30 | //================================================================================================ |
---|
31 | case 'raz': |
---|
32 | $ip_black=str_replace('*',"%",$ip_black); |
---|
33 | $query = "DELETE FROM `".MAIL_BLACK_LISTE_TABLE."` WHERE `ip` like '%".$ip_black."%' "; |
---|
34 | pwg_query($query); |
---|
35 | |
---|
36 | unset ($_SESSION['pwg_'.'action_spam']); |
---|
37 | break; |
---|
38 | |
---|
39 | default: |
---|
40 | break; |
---|
41 | |
---|
42 | } |
---|
43 | //================ Liste Black liste ================= |
---|
44 | $query = " |
---|
45 | SELECT *, COUNT(`ip`) as total , `ip` as blacklist, `ip` as U_DELETE |
---|
46 | FROM ".MAIL_BLACK_LISTE_TABLE." |
---|
47 | GROUP by ip |
---|
48 | ;"; |
---|
49 | $liste_bl = array(); |
---|
50 | $result = pwg_query($query); |
---|
51 | while ($row = pwg_db_fetch_array($result,MYSQL_ASSOC)) { |
---|
52 | array_push($liste_bl,$row); |
---|
53 | } |
---|
54 | //================ Liste IP ============== |
---|
55 | $req = pwg_query('SELECT count(distinct(`IP`)) FROM '.HISTORY_TABLE.' '); |
---|
56 | $op=pwg_db_fetch_row($req); |
---|
57 | $nbip = array_pop($op) ; |
---|
58 | |
---|
59 | $query = 'SELECT DISTINCT H.`id`, |
---|
60 | H.`date`, |
---|
61 | H.`time`, |
---|
62 | H.`user_id`, |
---|
63 | H.`IP`, |
---|
64 | COUNT(H.`IP`) as total |
---|
65 | FROM '.HISTORY_TABLE.' AS H |
---|
66 | WHERE "'.$ip.'"not LIKE H.`IP` ';// |
---|
67 | if (count($liste_bl)>0){ |
---|
68 | $query .= ' AND H.`IP` not IN ( SELECT `ip` |
---|
69 | FROM '.MAIL_BLACK_LISTE_TABLE.' ) '; |
---|
70 | } |
---|
71 | |
---|
72 | $query .= ' |
---|
73 | GROUP by H.`IP` |
---|
74 | ORDER by `id` DESC |
---|
75 | LIMIT '.(int)($params['per_page']*$params['start']).','.(int)$params['per_page'].' |
---|
76 | ' ; |
---|
77 | |
---|
78 | $result = pwg_query($query); |
---|
79 | $liste_ip=array(); |
---|
80 | while ($row = pwg_db_fetch_array($result,MYSQL_ASSOC)) { |
---|
81 | |
---|
82 | array_push($liste_ip, $row); |
---|
83 | } |
---|
84 | |
---|
85 | ?> |
---|