ricmetal Posted July 15, 2011 Share Posted July 15, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/242089-the-best-data-life-cycle/ Share on other sites More sharing options...
AyKay47 Posted July 15, 2011 Share Posted July 15, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/242089-the-best-data-life-cycle/#findComment-1243261 Share on other sites More sharing options...
KevinM1 Posted July 15, 2011 Share Posted July 15, 2011 ...and what happens if someone turns JavaScript off? Quote Link to comment https://forums.phpfreaks.com/topic/242089-the-best-data-life-cycle/#findComment-1243262 Share on other sites More sharing options...
ricmetal Posted July 15, 2011 Author Share Posted July 15, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/242089-the-best-data-life-cycle/#findComment-1243269 Share on other sites More sharing options...
AyKay47 Posted July 16, 2011 Share Posted July 16, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/242089-the-best-data-life-cycle/#findComment-1243497 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.