php - Cleansing external XML data before sending to MySQL database -



php - Cleansing external XML data before sending to MySQL database -

i'm working number of xml feeds retrieve info (from external source). retrieving data, sending own mysql database, can manipulate how wish.

i'm hoping advice on best practice in terms of process please. i'd create automated possible, i'm cautious of sending unvalidated xml info external source straight own database.

i putting in place few standard validations escape strings, etc, should looking 'cleanse' every piece of info (automatically) before committing own db?

should perhaps validate each piece of info against it's own set of rules before makes it's way database?

i hope that's clear enough. i'd love hear opinions if possible please.

there 2 things should worry about: 1 sql injection 2 cross-site scripting.

the first 1 simple utilize prepared statemants mysqli or pdo.

for corss-site scripting can either take clean before set in database or when retrieve it. personnely sec one. utilize function htmlspecialchars() before echo , should safe.

php mysql xml database

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -