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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering More Than One Link In Email Spam?

Status
Not open for further replies.

3dColor

Programmer
Jan 10, 2006
240
US
I would like to stop spammers that insert a bunch a links in to my contact form.

So I thought I could do something like

<cfif emailContactForm CONTAINS "http">
<cfset error = 1>
</cfif>

If the error equals 1 then don't send the email.

But sometimes I do get real emails with a link in it and I don't want to filter them, so how can I detect if there are more than 1 link in the email to filter those?
 
You could use the captcha that is built into CF8 to stop bots.

To answer your question:

<cfset stringToFind = "http">
<cfset startPos = 1>
<cfset foundCount = 0>

<cfloop from="1" to="100" index="i" step="1">
<cfif FindNoCase(stringToFind,yourContent,startPos)>
<cfset foundCount = foundCount + 1)>
<cfset startPos =
FindNoCase(stringToFind,yourContent,startPos)
<cfelse>
<cfbreak>
</cfif>
</cfloop>

Number Found = #foundCount#

Change the 'to' attribute in the loop to whatever maximum you think is necessary.

Cheers,




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top