Questions tagged [sanitization]

Data sanitization to prevent code injection

Data santization is used to prevent code injection problems, by secure input and output handling, such as:

  1. Input validation
  2. Selective input inclusion/exclusion
  3. Escaping dangerous characters. For instance, in PHP, using the htmlspecialchars() function (converts HTML tags to their ISO-8859-1 equivalents) and/or strip_tags() function (completely removes HTML tags) for safe output of text in HTML, and mysql_real_escape_string() to isolate data which will be included in an SQL request, to protect against SQL Injection.
  4. Input encoding
  5. Output encoding
  6. Other coding practices which are not prone to code injection vulnerabilities, such as "parameterized SQL queries" (also known as "prepared statements" and sometimes "bound variables" or "bound values").
  7. Modular shell disassociation from kernel
1083 questions
-1
votes
3 answers

php contact form validation (invalid email still sending)

So I am putting together a form and was recommended that I validate the form. I found a tutorial but seem to still be having problems getting the php to function. The html for the form:
Kasandra
  • 45
  • 12
-1
votes
1 answer

Need regex for utf8 multilingual search query

I need a Regex for to use with preg_replace php function in the search form input to use in SQL full text search in a MySQL multilingual utf8 database. I have considered using php filter_var with FILTER_SANITIZE_STRING, but I ended up with…
Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
-1
votes
4 answers

PHP code how to clean user input from $_POST

I have this PHP code: 100){ $grade11 = ""; } elseif ($_POST['passmarks12'] < 45){ $grade11 = "Fail"; } $strg = " $grade11"; echo…
user2260431
  • 75
  • 1
  • 3
  • 14
-2
votes
1 answer

How to sanitize input field in jQuery script

I would like to sanitize the form fields before sending the ajax request to increase security. Currently my Javascript code is this: jQuery(document).ready(function($) { $('#login-form').submit(function(e) { e.preventDefault(); // stop…
Snorlax
  • 183
  • 4
  • 27
-2
votes
2 answers

Is it possible to create an iFrame with no spaces?

I'm in a situation where I need a substitute for the " " (space) character when writing an