-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblacklist.cfm
41 lines (41 loc) · 1.48 KB
/
blacklist.cfm
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
<cfinclude template="/includes/_header.cfm">
<cfoutput>
<cfif action is "nothing">
<cfquery name="d" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select ip from uam.blacklist order by to_number(replace(ip,'.'))
</cfquery>
<cfset application.blacklist=valuelist(d.ip)>
<form name="i" method="post" action="blacklist.cfm">
<input type="hidden" name="action" value="ins">
<label for="ip">Add IP</label>
<input type="text" name="ip" id="ip">
<br><input type="submit" value="blacklist">
</form>
<cfloop query="d">
<br>#ip# <a href="blacklist.cfm?action=del&ip=#ip#">Remove</a>
<a href="http://whois.domaintools.com/#ip#" target="_blank">whois</a>
</cfloop>
</cfif>
<cfif action is "ins">
<cfif trim(ip) is "127.0.0.1">
<cfthrow message = "Local IP cannot be blacklisted" errorCode = "127001">
<cfabort>
</cfif>
<cftry>
<cfquery name="d" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into uam.blacklist (ip) values ('#trim(ip)#')
</cfquery>
<cflocation url="/Admin/blacklist.cfm">
<cfcatch>
<cfdump var=#cfcatch#>
</cfcatch>
</cftry>
</cfif>
<cfif action is "del">
<cfquery name="d" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
delete from uam.blacklist where ip = '#ip#'
</cfquery>
<cflocation url="/Admin/blacklist.cfm">
</cfif>
</cfoutput>
<cfinclude template="/includes/_footer.cfm">