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.
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.