Jump to content

filtering metacharacters for security


mat420

Recommended Posts

a vulnerbility scanner i  used said to filter metacharacters in my submission form

is this enough?

thank u

<?php 

$string = "This is some text and numbers 12345 and symbols !£$%^&"; 

$new_string = ereg_replace("[^A-Za-z0-9]", "", $string); 

echo $new_string 

?>

Link to comment
Share on other sites

Metacharacters are any characters that have special, interpretable meaning.  In PHP we have (\n, \r, \t, etc.) in strings that are metacharacters.  How you should filter your inputs all depends on what you want to do with those values later.  Are you simply wanting to echo them back to the browser or will you actually be doing something else with them?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.