Fix TMP issue and remove old sql dependency

Declare default temporary path fix TMP issue
Notice: Use of undefined constant TMP - assumed 'TMP' in include/Template.class.php on line 82
Template Error: unable to write file TMPtpl_c/wrt5311ccd8ee1174.15154048

Remove sql_exist, sql_update and sql_insert