ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #1  
Old June 28th, 2004, 03:03 PM
krugar krugar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 35 krugar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 20 sec
Reputation Power: 5
Is it possible to replace the @ symbol with an image using only CF?

I want to protect my site a little more from spam harvesters. Is there a way using only ColdFusion to replace the @ symbol with an image of the @ symbol?

I have successfully replaced the @ symbold with &##64; but don't have any luck replacing it with an image.

Thanks in advance.

Reply With Quote
  #2  
Old June 28th, 2004, 03:50 PM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,492 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 18 h 25 m 21 sec
Reputation Power: 44
You'll need to provide more information. Do you want CF to scan through a set of static pages and replace all @ characters with an <img> tag? Is the content coming out of a database? Can't give any help until I know more.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old June 28th, 2004, 04:19 PM
krugar krugar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 35 krugar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 20 sec
Reputation Power: 5
Sorry kiteless I guess I should have provided more.

I have dynamic pages whose content is being stored in a database. I have a field in table named email which obviously stores email addresses.

When CF serves up the page I would like it to replace all instances of @ in the email addresses on a page with an image.

In a perfect situation it would do this domain/system wide with something in the Application.cfm. However, I am not sure if this is possible or not. Thanks in advance.

Reply With Quote
  #4  
Old June 28th, 2004, 04:48 PM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,492 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 18 h 25 m 21 sec
Reputation Power: 44
Two ideas come to mind:

Replace the @ character with the desired image tag text in the SQL select statement. Consult your RDBMS documentation for appropriate instructions and functions to do this (most have a replace() function or something similar)

Write conditional code in the output of your data that replaces the @ with the image tag. This could also be done as a user-defined function like formatEmailImage() or something.

Hope that helps.

Reply With Quote
  #5  
Old June 29th, 2004, 05:12 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
I think kiteless first suggestion is the best option to replace a string from a database field. I don't know how you use the database queries in cold fusion. I normally write stored procedures to perform all the database actions and call that in cold fusion. In this way if we want to change some database table field value or something, we may just change the stored procedure and that reflects every where the query is used in the site.

<<
In a perfect situation it would do this domain/system wide with something in the Application.cfm. However, I am not sure if this is possible or not.
>>

I don't think this is possible from the Application.cfm as you need to use Replace function to change your query variable string.

Code:
<cfoutput>#REPLACE(query.fieldname,"@","<img src=""img/path/here"">)#</cfoutput>
__________________
SR -
webshiju.com
www.lizratechnologies.com

"The fear of the LORD is the beginning of knowledge..."

Reply With Quote
  #6  
Old June 29th, 2004, 09:10 AM
krugar krugar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 35 krugar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 20 sec
Reputation Power: 5
Thanks guys I figured out what my initial problem was. I did not use the double quotes in my img src tag in the Replace function.
Here is what works for me:
Code:
#REPLACE(email,"@","<img src=""/images/msc/at.gif"">")#


I'm not that familiar with Replace() but can you only replace one substring per function? I would like to include some code to not only replace the @ symbol but also the . with &##46.

Is there a way to combine the following replace statement with the one above?
Code:
 #Replace(email, ".", "&##46;", "All")#

Reply With Quote
  #7  
Old June 29th, 2004, 09:57 AM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,492 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 18 h 25 m 21 sec
Reputation Power: 44
You'll need to look into regular expressions if you want to do multiple replacements. Regex is a massive topic and take a good while to get proficient at, so unless you see a major problem I'd just do it in two separate statements.

Reply With Quote
  #8  
Old June 29th, 2004, 03:34 PM
krugar krugar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 35 krugar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 20 sec
Reputation Power: 5
Thanks, I'll look into it. Any suggested places to start for the layman?

Reply With Quote
  #9  
Old June 29th, 2004, 03:50 PM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,492 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 18 h 25 m 21 sec
Reputation Power: 44
Nothing specific. I'm sure a Google search for "regular expressions" or "regex" will give you more than you could possibly want to see!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Is it possible to replace the @ symbol with an image using only CF?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway