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:
- This does not work for multi-dimensional arrays.
- You can not consider every single
$ _ POST
value as a DB parameter and 3). - It may be reducing unnecessarily.
-
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
Post a Comment