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

Link to comment
Share on other sites

the problem with a javascript application is as nightslyr already stated, if the users browser is configured to disable javascript, which surprisingly still happens these days, your application will be rendered useless to them

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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