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

PHP and SMS
Hi all forum members. I am new here and am unsure what category shoild I post this in.
Moderator

mail() problem
Hi Guys,

I've set up a contact email form. It sends the information fine, but it sends it to

First root of a number
Hi,

I can't find any function in php to give me the first root of a number.
Is there any

Saas with SAP R/3
hi experts,

Is SaaS offer available in SAP? for SAP R/3? from where i can get the info a

Locking mysql tables with php
Hi

BACKGROUND:
I have multiple instances of the same php script running in a WAMP environ

foreach and array need help combining
Hi guys.

Here's the code

Code: array(
'tag' => 'code',<

noob cURL help
I have a pretty basic form that I need to cURL post to a file in my includes folder (includes/login.

Login page problems
I developed a website a few months ago and I am now having an issue with logging into it. The place

import table with dependency
Hi

What is the best way to import table back which has dependency?

SQL> cre

Map.php
I am a complete beginner to PHP and am looking for some help with a program I am messing around with

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