Пример #1
0
     $preqiel = isset($_POST['preqiel']) && trim($_POST['preqiel']) ? trim($_POST['preqiel']) : null;
     $price = isset($_POST['price']) ? (int) $_POST['price'] : null;
     $game_estatus = isset($_POST['game_estatus']) ? (int) $_POST['game_estatus'] : null;
     $game_sdate = isset($_POST['game_sdate']) ? (int) $_POST['game_sdate'] : null;
     $x = isset($_POST['x']) ? (int) $_POST['x'] : null;
     $y = isset($_POST['y']) ? (int) $_POST['y'] : null;
     if ($season_id && $title && $intro && $place && $price && $game_estatus && $game_sdate) {
         // Обработать лого
         $file_path = $GAME_IMAGES_PATH . $_FILES['logo']['name'];
         if (is_uploaded_file($_FILES["logo"]["tmp_name"])) {
             if (move_uploaded_file($_FILES['logo']['tmp_name'], '/uploads_')) {
                 echo 'moved - ' . $_SERVER['DOCUMENT_ROOT'] . $file_path;
                 $logo = $_FILES['logo']['name'];
             }
         }
         $game_model->add_game($season_id, $title, $logo, $intro, $place, $legend, $preqiel, $price, GAME_CREATED, $game_estatus, $game_sdate, null, $x, $y);
     }
 } else {
     if ($action == 'update_game') {
         $game_id = isset($_POST['game_id']) ? (int) $_POST['game_id'] : null;
         $season_id = isset($_POST['season_id']) ? (int) $_POST['season_id'] : null;
         $title = isset($_POST['title']) && trim($_POST['title']) ? trim($_POST['title']) : null;
         $intro = isset($_POST['intro']) && trim($_POST['intro']) ? trim($_POST['intro']) : null;
         $place = isset($_POST['place']) && trim($_POST['place']) ? trim($_POST['place']) : null;
         $legend = trim($_POST['legend']);
         $preqiel = trim($_POST['preqiel']);
         $price = isset($_POST['price']) ? (int) $_POST['price'] : null;
         $game_estatus = isset($_POST['game_estatus']) ? (int) $_POST['game_estatus'] : null;
         $game_sdate = isset($_POST['game_sdate']) ? (int) $_POST['game_sdate'] : null;
         $x = isset($_POST['x']) ? (int) $_POST['x'] : null;
         $y = isset($_POST['y']) ? (int) $_POST['y'] : null;