This repository has been archived by the owner on May 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drop.php
112 lines (105 loc) · 2.95 KB
/
drop.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
<?php
##########################
# RBL update application #
##########################
include "config.php";
//$result = $mysqli->query("SELECT * FROM ips LIMIT 10");
//print_r($result);
$reportedby = $_SERVER['REMOTE_ADDR'];
$ipaddress = ""; $notes = ""; $blackorwhite = "";
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if (isset($_POST['ipaddress'])) {
$ipaddress = $_POST['ipaddress'];
}
if (isset($_POST['notes'])) {
$notes = addslashes($_POST['notes']);
}
if (isset($_POST['blackorwhite'])) {
$blackorwhite = $_POST['blackorwhite'];
}
} else {
if (isset($_GET['ipaddress'])) {
$ipaddress = $_GET['ipaddress'];
}
if (isset($_GET['notes'])) {
$notes = $_GET['notes'];
}
if (isset($_GET['blackorwhite'])) {
$blackorwhite = $_GET['blackorwhite'];
}
}
##################################################################
# see if this browser client is allowed to update mysql database #
##################################################################
$allowed = 0;
switch ($_SERVER['REMOTE_ADDR']) {
case "213.141.131.101":
$allowed = 1; # mail2.yourdomain.com
break;
case "84.253.104.246":
$allowed = 1; # mail3.yourdomain.com
break;
case "39.227.237.20":
$allowed = 1; # office.yourdomain.com
break;
}
if (($allowed) and ($ipaddress != "")) {
$query = "insert into ips set ipaddress='{$ipaddress}', reportedby='{$reportedby}', attacknotes='{$notes}', b_or_w='{$blackorwhite}', dateadded=now(), updated=now();";
$mysqli->query($query) or die ($mysqli->error);
}
/* close connection */
mysqli_close($link);
?>
<html>
<head>
<title>RBL Drop</title>
</head>
<body>
<h2>RBL Drop</h2>
<h3>Relay Blacklist</h3>
<p><?php echo $_SERVER['REMOTE_ADDR']; ?></p>
<?php
$check = false;
$check_result = 0;
if (isset($_POST['ipaddress'])) {
$check = true;
$ipaddress = $_POST['ipaddress'];
$result = $mysqli->query("SELECT COUNT(*) FROM `ips` WHERE ipaddress = '".$ipaddress."'");
$row = $result->fetch_row();
$check_result = $row[0];
}
?>
<?php
if ($check == true) {
if ($check_result == 0) {
print "<p style='color: green'>IP address {$ipaddress}: OK</p>";
} else {
print "<p style='color: red'>IP address: {$ipaddress} in RBL</p>";
}
}
?>
<form action="drop.php" method="post">
<table border="0">
<tr>
<td align="right">IP Address:</td>
<td align="left"><input type="text" name="ipaddress" size="20"></td>
</tr>
<tr>
<td align="right" valign="top">Attack Notes:</td>
<td align="left"><textarea name="notes" rows="6" cols="30"></textarea></td>
</tr>
<tr>
<td align="right">Deny Or Allow:</td>
<td align="left"><select name="blackorwhite"><option value="b">black</option><option value="w">white</option></select></td>
</tr>
<tr>
<td align="right" valign="top"> </td>
<td align="left">
<input type="submit" name="Submit" value="Submit">
<input type="reset" />
</td>
</tr>
</table>
</form>
</body>
</html>