Securing a user input - need some confirmation


Posted on 16th Feb 2014 07:03 pm by admin

Hello All,

I am in the process of recoding a large proportion of an e-commerce site, one of the problems is that there are a few security issues floating around.

Did you know?Explore Trending and Topic pages for more stories like this.
I have a search box which was originally unprotected against XSS, I was easily able to execute JavaScript and force the system to echo out HTML *holds head in hands*.

I am using this code:

$term=preg_replace('/[^a-zA-Z0-9s]/', "", $term);

...to remove any non-alphanumeric characters (excluding spaces), I am thinking because this will strip out any characters like ', ", <, >, /, = etc, it should make my script safe again.

Can you confirm this, or is there something that I am missing?


Many thanks
No comments posted yet

Your Answer:

Login to answer
217 Like 28 Dislike
Previous forums Next forums
Other forums

Sendmail.php - heading error following check_input
Hi,

I would greatly appreciate some help? I am brand new to PHP and have been searching and e

Need help with cin setw
I made a program here is my code:

#include
#include
#i

Need help in log in and log out?
hi there all of u. i have recently created a site for someone. i have placed log in and log out and

$get problem
Hi Guys ...

can you please tell me what i am doing wrong here
Code: <?php

Embed Video Problem
Hey, thanks for looking!

File to be embedded:

Code: <playlist version="1&q

AJAX form submit
I recently built a form that submits data to my database with an ajax function that is called throug

Including calander to page - will not show other months than current??
im trying to add an existaing calander onto a profile page by using Code: <?php include "

HTML Email rec'd as Source Code
The code does create and send the email successfully. However, the message shows as html code and n

help me fix these syntax errors...
I keep getting multiple syntax errors on this script like this one:

Parse error: syntax error

List/Menu Box
On an edit page when you want something to select what a user has previously selected from the datab

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash