Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ip address redirect/block

Status
Not open for further replies.

besnette1

Technical User
Jun 19, 2001
9
Hello -
I am trying to do a simple code to redirect spammers or 'bad guys' when they come to my site, based on their IP address. I have a table in my database of the bad ip addresses - table name bannedipaddresslist, and the field is simply ip.

I have a code that I think is *almost* working, but I keep getting an error that I can't figure out.

MY Code:

<cfset domain = cgi.remote_addr>
<cfquery name="checkipaddress" datasource="mydatasource">
SELECT
ip*
FROM
bannedipaddresslist
WHERE
ip = #domain#
</cfquery>
<cfif checkipaddress.recordcount GT 0>
<cflocation url="</cfif>


The error:
Syntax error or access violation: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM bannedipaddresslist WHERE ip = 86.190.127.161' at line 3

The error occurred in D:\INETPUB\widget\sitemap.cfm: line 8

6 : bannedipaddresslist
7 : WHERE
8 : ip = #domain#
9 : </cfquery>
10 : <cfif checkipaddress.recordcount GT 0>

Thank you in advance for anyone that can help with suggestions or insight. I really appreciate it.
 
Hi TruthInSatire,
Worked great. Thanks for the help. I really appreciate it.
DB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top