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

Hardcopy printing is to wide
I want to make a hardcopy at runtime of my active form like this

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

PHP error on MySQL insert
I'm sure it's the simplest of issues, but I can't recall why this isn't working.

Code: [Selec

understanding functions and classes
Code: [Select]
class person {
var $name = "Jimmy Goe";

function get_nam

Form Help
Here is the form:

Line number On/Off | Expand/Contract<? include("../include/sess

help removing unwanted graphic
How do I remove the small elongated rectangular shape between the "Latest post" and "

Question about the upload of large files
Hi there,

I have a question about the upload of large files, like videos (files generally abo

array empty
Hiya peeps,

Ok here is the codes.

order.php

Code:

Ajax Error since Upgrading to 3.5
Ever since upgrading my site to .NET 3.5 (I needed LINQ), I've been getting this annoying error on o

PHP and MySQL Question/Help
I have a MySQL db with all my servers and all their details like server name, IP, OS, RAM etc etc 26

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