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:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old March 19th, 2005, 05:28 PM
charmed0rz charmed0rz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 142 charmed0rz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 49 m 31 sec
Reputation Power: 5
Forms and not allowing HTML

I have a chatroom... and sometimes they type <b>Hi</b> and i don't want this. I was wondering how i could go about blocking html/javascript from being submitting.. i had originally thought about just blocking the first letter if it was '<' ... but then they could just do... "... <b>Hi</b>"

So any ideas?

Reply With Quote
  #2  
Old March 19th, 2005, 06:13 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 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 4 Days 10 h 8 m 55 sec
Reputation Power: 53
You could use regular expressions to extract any tags (I'm sure a search on the net will yield many such scripts). Or you could just use the htmlCodeFormat() function on the string before you insert it into the database. This replaces the < and > symbols with their ascii codes, effectively neutralizing any tags.

CFMX 7 has a built in option in the Application.cfc file or <cfapplication> tag called "scriptProtect" that will filter out any code or script-hijacking attempts from whatever scopes you specify.
__________________
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 March 19th, 2005, 06:21 PM
charmed0rz charmed0rz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 142 charmed0rz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 49 m 31 sec
Reputation Power: 5
Oh how I wish I could be on 7 already

Quote:
Originally Posted by kiteless
You could use regular expressions to extract any tags (I'm sure a search on the net will yield many such scripts). Or you could just use the htmlCodeFormat() function on the string before you insert it into the database. This replaces the < and > symbols with their ascii codes, effectively neutralizing any tags.

CFMX 7 has a built in option in the Application.cfc file or <cfapplication> tag called "scriptProtect" that will filter out any code or script-hijacking attempts from whatever scopes you specify.

Reply With Quote
  #4  
Old March 19th, 2005, 06:47 PM
charmed0rz charmed0rz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 142 charmed0rz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 49 m 31 sec
Reputation Power: 5
Ooh that function did exactly what I needed to. Thanks

Quote:
Originally Posted by charmed0rz
Oh how I wish I could be on 7 already

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Forms and not allowing HTML


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


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





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