Jump to content

the best data life cycle


ricmetal

Recommended Posts

hi guys

im struggling with data. encoding, decoding, validation, sanitation...i have come up with this life cycle for data i would like to share and see how or if it can be improved.

 

the first line is based on the data life cycle of a variable passed with AJAX to the database and back.

the second line is a simple dbase data fetch and html print.

 

limit char length in javascript, encode, decode in php, limit in php, insert in db. fetch from db, encode in php, decode in javascript, sanitize before html insert.

 

for simple db fetches in php and direct html insert, just sanitize

 

any comments would be great.

Link to comment
https://forums.phpfreaks.com/topic/242089-the-best-data-life-cycle/
Share on other sites

definitely need to sanitize using PHP's mysql_real_escape_string before db insertion,

the only input that would need encoded, decoded that I can think of are URL's or serialized information/JSON

 

hi AyKay47, i am using prepared statement so theres no need to use real_escape functions.

 

...and what happens if someone turns JavaScript off?

so far my web app will only work with javascript enabled.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.