Файл: pages/clan/hall-action.php
Строк: 48
<?php
// Physical module map v50.6: public URL stays clean while code lives in /pages.
if (!defined('GAME_ROOT')) define('GAME_ROOT', dirname(__DIR__, 2));
chdir(GAME_ROOT);
if (PHP_SAPI !== 'cli') { $_SERVER['PHP_SELF']='/hall-action.php'; $_SERVER['SCRIPT_NAME']='/hall-action.php'; }
/* Запуск попытки рекорда. Отмена выполняется только через отдельное подтверждение. by Метриум (Стэлп) */
require_once './system/common.php'; require_once './system/functions.php'; require_once './system/user.php';
if(!$user){ header('Location:/'); exit; }
if(($_SERVER['REQUEST_METHOD']??'GET')!=='POST'){ header('Location:/clan/'); exit; }
security_require_csrf();
$scope=(string)($_POST['scope']??'personal'); $code=(string)($_POST['code']??'');
if(!in_array($scope,['personal','clan'],true)) $scope='personal';
$defs=$scope==='clan'?game_hall_clan_defs():game_hall_personal_defs();
$back=$scope==='clan'?'/hall-clan/':'/hall-personal/';
if(!isset($defs[$code])){ $_SESSION['err']='Некорректный рекорд.'; header('Location:'.$back); exit; }
$cm=game_hall_user_clan((int)$user['id']);
if(!$cm){ $_SESSION['err']='Зал славы доступен только участникам клана.'; header('Location:/clans/'); exit; }
$cid=(int)$cm['clan']; $entityId=$scope==='clan'?$cid:(int)$user['id'];
if($scope==='clan' && (int)$cm['rank']<4){ $_SESSION['err']='Устанавливать клановый рекорд может лидер или заместитель.'; header('Location:'.$back); exit; }
if(!isset($_POST['start'])){ header('Location:'.$back); exit; }
[$ok,$msg]=game_hall_start_attempt($scope,$code,$entityId,(int)$user['id'],$cid);
if(!$ok) $_SESSION['err']=$msg; else $_SESSION['ok']=$msg;
header('Location:'.$back); exit;