function check_user_exit($user, $pass) { global $USERNAME, $PASSWORD; if ($user === $USERNAME && $pass === $PASSWORD) { jsonp_echo(['status' => 'ok']); } else { jsonp_echo(['status' => 'error', 'message' => 'username or password not matched']); } exit; }
function main() { $PARAMS = array_merge($_GET, $_POST); switch (@$PARAMS['cmd']) { case 'config': update_loader_js(); break; case 'listview': jsondb_views($PARAMS['db_name'], $PARAMS['table_name'], true); break; case 'reset': if (RESET_KEY === @$PARAMS['key']) { jsondb_reset(@$PARAMS['db_name'], @$PARAMS['table_name']); } break; case 'debug': data_idlist('grep-datas', 'historys', 33, false); break; } jsonp_echo(['status' => 'ok']); exit; }
jsonp_echo(handle_heartbeat_cmd()); break; case 'admin': jsonp_echo(handle_admin_cmd()); break; case 'kword': jsonp_echo(handle_bind_keyword($PARAMS)); break; case 'bind': jsonp_echo(handle_bind_account($PARAMS)); break; case 'debug': jsonp_echo(handle_debug_cmd()); break; default: jsonp_echo(['status' => 'error', 'error' => 'unreconized cmd.']); } fastcgi_finish_request(); sync_job(); put_device_saved($DEVSAV); exit; /***************** ---------- *****************/ /***************** 异步处理 *****************/ /***************** ---------- *****************/ function sync_job($job_type = null, $cmd_arr = null) { global $CONFIGS, $DEVSAV, $PARAMS, $SYNJOBS; if ($job_type && $cmd_arr) { return group_list($SYNJOBS, $job_type, $cmd_arr); } foreach ($SYNJOBS as $job_type => $cmd_datas) {