Remove cutenews/yui, use twitter bootstrap css
[contractdashboard.git] / ipban.mdu
1 <?PHP
2 if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permission for this section"); }
3 // ********************************************************************************
4 // Add IP
5 // ********************************************************************************
6 if($action == "add" OR $action == "quickadd")
7 {
8 if(!$add_ip){ msg("error","Error !!!","The IP can not be blank", "$PHP_SELF?mod=ipban"); }
9
10 $all_ip = file("./data/ipban.db.php");
11 $exist = FALSE;
12 foreach($all_ip as $ip_line)
13 {
14 $ip_arr = explode("|", $ip_line);
15 if($ip_arr[0] == $add_ip){ $exist = TRUE; }
16 }
17 if(!$exist)
18 {
19 $new_ips = fopen("./data/ipban.db.php", "a");
20 $add_ip = stripslashes( preg_replace(array("'\|'",), array("I",), $add_ip) );
21 fwrite($new_ips, "$add_ip|0||\n");
22 fclose($new_ips);
23 }
24
25 if($action == "quickadd"){ die('The IP '.$add_ip.' is now banned from commenting.'); }
26 }
27 // ********************************************************************************
28 // Remove IP
29 // ********************************************************************************
30 elseif($action == "remove")
31 {
32 if(!$remove_ip){ msg("error","Error !!!","The IP can not be blank", "$PHP_SELF?mod=ipban"); }
33
34 $old_ips = file("./data/ipban.db.php");
35 $new_ips = fopen("./data/ipban.db.php", "w");
36
37 foreach($old_ips as $old_ip_line){
38 $ip_arr = explode("|", $old_ip_line);
39 if($ip_arr[0] != stripslashes($remove_ip)){
40 fwrite($new_ips, $old_ip_line);
41 }
42 }
43 fclose($new_ips);
44 }
45 // ********************************************************************************
46 // List all IP
47 // ********************************************************************************
48 echoheader("options", "IP Blocking");
49
50 echo'<table border=0 cellpading=0 cellspacing=0 width="645" >
51 <form method=post action="'.$PHP_SELF.'">
52 <td width=321 height="33">
53 <b>Block IP</b>
54 <table border=0 cellpading=0 cellspacing=0 width=379 class="panel" cellpadding="7" >
55 <tr>
56 <td width=79 height="25">
57 &nbsp;IP Address : <br>&nbsp;<br>&nbsp;
58 <td width=274 height="25">
59 <input type=text name=add_ip>&nbsp;&nbsp; <input type=submit value="Block this IP"><br> <br>
60 example: <i>129.32.31.44</i> or <i>129.32.*.*</i>
61 </tr>
62 <input type=hidden name=action value=add>
63 <input type=hidden name=mod value=ipban>
64 </form>
65 </table>
66 <tr>
67 <td width=654 height="11">
68 <img height=20 border=0 src="skins/images/blank.gif" width=1>
69 </tr><tr>
70 <td width=654 height=14>
71 <b>Blocked IP Addresses</b>
72 </tr>
73 <tr>
74 <td width=654 height=1>
75 <table width=641 height=100% cellspacing=0 cellpadding=0>
76 <tr>
77 <td width=15 bgcolor=#F7F6F4></td>
78 <td width=260 bgcolor=#F7F6F4><u>IP</u></td>
79 <td width=218 bgcolor=#F7F6F4><u>times been blocked</u></td>
80 <td width=140 bgcolor=#F7F6F4>&nbsp;<u>unblock</u></td>
81 </tr>';
82
83
84 $all_ips = file("./data/ipban.db.php");
85 $i = 0;
86 foreach($all_ips as $ip_line)
87 {
88 if(!eregi("<\?",$ip_line))
89 {
90 if($i%2 != 0){ $bg = "bgcolor=#F7F6F4"; }else{ $bg = ""; }
91 $i++;
92 $ip_arr = explode("|", $ip_line);
93 $ip_arr[0] = stripslashes( preg_replace(array("'\"'", "'\''"), array("&quot;", "&#039;"), $ip_arr[0]) );
94 echo"
95 <tr $bg height=18>
96 <td></td>
97 <td>
98 <a href=\"http://www.ripe.net/perl/whois?searchtext=$ip_arr[0]\" target=_blank title=\"Get more information about this ip\">$ip_arr[0]</a>
99 </td>
100 <td>$ip_arr[1]</td>
101 <td>
102 <a href=\"$PHP_SELF?mod=ipban&action=remove&remove_ip=$ip_arr[0]\">[unblock]</a></td>
103 </tr>
104 ";
105 }
106 }
107
108 if($i == 0){ echo"<tr><td align=center colspan=5><br> &nbsp;No blocked IP's</td></tr>"; }
109
110 echo'</table></table>';
111
112 echofooter();
113 ?>