TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-27-2008, 12:30 PM   #1 (permalink)
The Wanderer
 
Join Date: Jan 2008
Posts: 21
Thanks: 0
Speeple is on a distinguished road
Default Cleaning Blog Input

I'm working on a blog service and I'm interested if anyone has any experience in "cleaning" the user input?

Things like recursive regular expressions to clean lists (dl, ul, li, ol etc.) are resource intensive and I imagine other services use simpler methods (which I'm not aware of )

Does anybody know of any example code?
__________________
AKA Martin Gallagher
Speeple is offline  
Reply With Quote
Old 02-27-2008, 02:11 PM   #2 (permalink)
The Contributor
 
Join Date: Jan 2008
Posts: 25
Thanks: 8
cosmok is on a distinguished road
Default

some functions that you might use: strip_tags(), mysql_escape_string() and htmlentities(). Otherwise use standard libraries like HTML Purifier - Filter your HTML the standards-compliant way! to clean user input.
cosmok is offline  
Reply With Quote
The Following 2 Users Say Thank You to cosmok For This Useful Post:
abiko (02-27-2008), EyeDentify (02-28-2008)
Old 02-27-2008, 02:30 PM   #3 (permalink)
The Wanderer
 
Join Date: Jan 2008
Posts: 21
Thanks: 0
Speeple is on a distinguished road
Default

Hey cosmok, never heard of "HTML Purifier" until now and it looks like an awesome set of classes!

Life saver mate, cheers!
__________________
AKA Martin Gallagher
Speeple is offline  
Reply With Quote
Old 02-27-2008, 10:39 PM   #4 (permalink)
The Contributor
 
Join Date: Jan 2008
Posts: 25
Thanks: 8
cosmok is on a distinguished road
Default

glad u found that useful.
cosmok is offline  
Reply With Quote
Old 02-27-2008, 10:46 PM   #5 (permalink)
The Contributor
 
abiko's Avatar
 
Join Date: Feb 2008
Location: Croatia
Posts: 90
Thanks: 4
abiko is on a distinguished road
Default

Yeah, thanks man on that find :)
I've been looking to implent Input_Filter (used by Mambo/Joomla) - but don't like the way it filters :)
This is much simpler
__________________
Back from sysadmins to the programmers.
Send a message via ICQ to abiko Send a message via MSN to abiko
abiko is offline  
Reply With Quote
Old 03-11-2008, 08:52 PM   #6 (permalink)
The Visitor
 
Join Date: Mar 2008
Location: Florida
Posts: 1
Thanks: 0
pH4nToM is on a distinguished road
Default

I still prefer

<?php htmlentities(mysql_escape_string($string)); ?>
Send a message via AIM to pH4nToM Send a message via MSN to pH4nToM
pH4nToM is offline  
Reply With Quote
Old 03-14-2008, 10:28 PM   #7 (permalink)
WebDev'n Beer Drnkn' Fool
 
stewart's Avatar
 
Join Date: Dec 2007
Location: Denver, CO
Posts: 59
Thanks: 2
stewart is on a distinguished road
Default

htmlspecialchars(addslashes()); works for me most of the time ;D
__________________
stewart::howe
Web Developer & Programmer
CelerMedia.Com | iAmStewart.com | CelerLabs.com
Send a message via ICQ to stewart Send a message via AIM to stewart Send a message via MSN to stewart Send a message via Yahoo to stewart
stewart is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 12:09 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design