diff --git a/f_install/j_install_status.php b/f_install/j_install_status.php index 8b6021b4..23e87164 100644 --- a/f_install/j_install_status.php +++ b/f_install/j_install_status.php @@ -3,18 +3,6 @@ namespace sammo; require(__dir__.'/../vendor/autoload.php'); -function dbConnFail($params){ - Json::die([ - 'step'=>'conn_fail' - ]); -} - -function dbSQLFail($params){ - Json::die([ - 'step'=>'sql_fail' - ]); -} - if(!class_exists('\\sammo\\RootDB')){ Json::die([ 'step'=>'config' @@ -24,11 +12,20 @@ if(!class_exists('\\sammo\\RootDB')){ $rootDB = RootDB::db(); $rootDB->throw_exception_on_nonsql_error = false; -$rootDB->nonsql_error_handler = 'dbConnFail'; -$rootDB->error_handler = 'dbSQLFail'; +$rootDB->nonsql_error_handler = function($params){ + Json::die([ + 'step'=>'conn_fail' + ]); +}; + +$rootDB->error_handler = function($params){ + Json::die([ + 'step'=>'sql_fail' + ]); +}; $memberCnt = $rootDB->queryFirstField('SELECT count(`NO`) from MEMBER'); -if($memberCnt === 0){ +if($memberCnt == 0){ Json::die([ 'step'=>'admin', 'globalSalt'=>RootDB::getGlobalSalt() diff --git a/f_install/j_setup_db.php b/f_install/j_setup_db.php index 3b88934d..24629212 100644 --- a/f_install/j_setup_db.php +++ b/f_install/j_setup_db.php @@ -3,20 +3,6 @@ namespace sammo; require(__dir__.'/../vendor/autoload.php'); -function dbConnFail($params){ - Json::die([ - 'result'=>false, - 'reason'=>'DB 접속에 실패했습니다.' - ]); -} - -function dbSQLFail($params){ - Json::die([ - 'result'=>false, - 'reason'=>'SQL을 제대로 실행하지 못했습니다. DB상태를 확인해 주세요.' - ]); -} - $host = Util::array_get($_POST['db_host']); $port = Util::array_get($_POST['db_port']); $username = Util::array_get($_POST['db_id']); @@ -118,8 +104,19 @@ $rootDB = new \MeekroDB($host,$username,$password,$dbName,$port,'utf8mb4'); $rootDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true; $rootDB->throw_exception_on_nonsql_error = false; -$rootDB->nonsql_error_handler = 'dbConnFail'; -$rootDB->error_handler = 'dbSQLFail'; +$rootDB->nonsql_error_handler = function($params){ + Json::die([ + 'result'=>false, + 'reason'=>'DB 접속에 실패했습니다.' + ]); +}; + +$rootDB->error_handler = function($params){ + Json::die([ + 'result'=>false, + 'reason'=>'SQL을 제대로 실행하지 못했습니다. DB상태를 확인해 주세요.' + ]); +}; $mysqli_obj = $rootDB->get(); //로그인에 실패할 경우 자동으로 dbConnFail()이 실행됨. diff --git a/hwe/_119_b.php b/hwe/_119_b.php index 591c9008..7e739339 100644 --- a/hwe/_119_b.php +++ b/hwe/_119_b.php @@ -11,6 +11,18 @@ if($session->userGrade < 5){ echo '_119.php';//TODO:debug all and replace } +$v = new Validator($_POST); +$v->rule('integer', [ + 'minute', + 'minutes2' +]); +if(!$v->validate()){ + Error($v->errorStr()); +} + +$minute = Util::toInt(Util::array_get($_POST['minute'])); +$minute2 = Util::toInt(Util::array_get($_POST['minute2'])); + $db = DB::db(); $connect=$db->get(); diff --git a/hwe/_admin1.php b/hwe/_admin1.php index 154e4b68..66c069d2 100644 --- a/hwe/_admin1.php +++ b/hwe/_admin1.php @@ -49,9 +49,6 @@ $admin = getAdmin();