php - Is this smart or no? -


Is it okay to use this code to trim in my register function and avoid all posts? Or it is a good practice to touch and avoid every practice.

  // Clean and clean our input $ _POST = array_map ('trim', $ _POST); $ _POST = array_map ('mysql_real_escape_string', $ _POST); If (invalid input) is entered in the DOSTFILE user (user name, passwd) values ​​('{$ _POST [' user name ']}', '{$ _ POST [' passwd ']}')  

No, because:

  1. This does not work for multi-dimensional arrays.
  2. You can not consider every single $ _ POST value as a DB parameter and 3).
  3. It may be reducing unnecessarily.
  4. mysql_real_escape_string () might require a $ link_identifier argument.

Point # 1 can be worked with a custom recursive function, the price of more slowdown.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -