Address code review issues

- Escape SQL queries propperly
- use <input .. > instead of <input ... />
- remove debug echo
- comments
Move django database settings from oc_appconfig table to config.php