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-18-2008, 06:04 PM   #1 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default how to filter textboxes or fields from xss

i have a form with textboxes, textarea, and other fields.

how do i filter from having a user enter html or javascript or any other markup besides addslashes ?
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 02-18-2008, 06:07 PM   #2 (permalink)
The Addict
 
Join Date: Nov 2007
Posts: 264
Thanks: 2
TlcAndres is on a distinguished road
Default

htmlentities and the like
TlcAndres is offline  
Reply With Quote
Old 02-18-2008, 06:14 PM   #3 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default

cool thnx

im wondering how to filter like myspace does for example if you do use it.

if you edit your profile and enter javascript for example

<script>alert(something);</script> and when you save your profile

myspace outputs it like this: ..alert(something);..
it converts javascript markup to dots.
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 02-18-2008, 06:17 PM   #4 (permalink)
The Addict
 
Join Date: Nov 2007
Posts: 264
Thanks: 2
TlcAndres is on a distinguished road
Default

PHP Code:
$array = array('<script>'=>'...','</script>'=>'...');
$string '<script>alert(something);</script>';
$nS str_replace(array_keys($array),array_values($array),$string);
echo 
$nS
TlcAndres is offline  
Reply With Quote
Old 02-18-2008, 07:38 PM   #5 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default

Use the php filter extension:

PHP: Filter - Manual
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
The Following User Says Thank You to Kalle For This Useful Post:
flyingbuddha (02-21-2008)
Old 02-18-2008, 09:58 PM   #6 (permalink)
The Wanderer
 
dylanfm's Avatar
 
Join Date: Jan 2008
Location: Australia
Posts: 14
Thanks: 1
dylanfm is on a distinguished road
Default

Or this glorious thing: HTML Purifier - Filter your HTML the standards-compliant way!
Send a message via ICQ to dylanfm
dylanfm 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 04:02 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