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) = mysql_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 = mysql_fetch_array($result,MYSQL_ASSOC)) { |
---|
52 | array_push($liste_bl,$row); |
---|
53 | } |
---|
54 | //================ Liste IP ============== |
---|
55 | $req = mysql_query('SELECT count(distinct(`IP`)) FROM '.HISTORY_TABLE.' '); |
---|
56 | $nbip = array_pop(mysql_fetch_row($req)) ; |
---|
57 | |
---|
58 | $query = 'SELECT DISTINCT H.`id`, |
---|
59 | H.`date`, |
---|
60 | H.`time`, |
---|
61 | H.`user_id`, |
---|
62 | H.`IP`, |
---|
63 | COUNT(H.`IP`) as total |
---|
64 | FROM '.HISTORY_TABLE.' AS H |
---|
65 | WHERE "'.$ip.'"not LIKE H.`IP` ';// |
---|
66 | if (count($liste_bl)>0){ |
---|
67 | $query .= ' AND H.`IP` not IN ( SELECT `ip` |
---|
68 | FROM '.MAIL_BLACK_LISTE_TABLE.' ) '; |
---|
69 | } |
---|
70 | |
---|
71 | $query .= ' |
---|
72 | GROUP by H.`IP` |
---|
73 | ORDER by `id` DESC |
---|
74 | LIMIT '.(int)($params['per_page']*$params['start']).','.(int)$params['per_page'].' |
---|
75 | ' ; |
---|
76 | |
---|
77 | $result = pwg_query($query); |
---|
78 | $liste_ip=array(); |
---|
79 | while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { |
---|
80 | |
---|
81 | array_push($liste_ip, $row); |
---|
82 | } |
---|
83 | |
---|
84 | ?> |
---|