function sec_login() { global $lng, $settings; $_URL_forgotpass = "******"; if (isset($_GET['forgotpass'])) { if (!isset($_POST['_retry'])) { title($lng->getTrn('login/forgotpass')); } if (isset($_GET['cid']) && isset($_GET['activation_code'])) { $c = new Coach((int) $_GET['cid']); status($new_passwd = $c->confirmActivation($_GET['activation_code'])); echo "<br><br>"; echo $lng->getTrn('login/temppasswd') . " <b>{$new_passwd}</b><br>\n"; echo '<a href="' . urlcompile(T_URL_PROFILE, T_OBJ_COACH, $_GET['cid'], false, false) . '&subsec=profile">' . $lng->getTrn('login/setnewpasswd') . '.</a>'; } else { if (isset($_POST['coach_AC']) && isset($_POST['email'])) { $cid = get_alt_col('coaches', 'name', $_POST['coach_AC'], 'coach_id'); $c = new Coach($cid); $correct_user = $c->mail == $_POST['email']; status($correct_user, $correct_user ? '' : $lng->getTrn('login/mismatch')); if ($correct_user) { $c->requestPasswdReset(); echo "<br><br>"; echo $lng->getTrn('login/resetpasswdmail') . '.'; } else { // Return to same page. unset($_POST['coach']); unset($_POST['email']); $_POST['_retry'] = true; sec_login(); } } else { ?> <div class='boxCommon'> <h3 class='boxTitle<?php echo T_HTMLBOX_COACH; ?> '><?php echo $lng->getTrn('login/forgotpass'); ?> </h3> <div class='boxBody'> <form method="POST" action="<?php echo $_URL_forgotpass; ?> "> <?php echo $lng->getTrn('login/loginname'); ?> <br> <input type="text" name="coach_AC" size="20" maxlength="50"> <br><br> Email<br> <input type="text" name="email" size="20" maxlength="50"> <br><br> <input type="submit" name="reqAC" value="<?php echo $lng->getTrn('common/submit'); ?> "> </form> </div> </div> <?php } } } else { title($lng->getTrn('menu/login')); ?> <div class='boxCommon'> <h3 class='boxTitle<?php echo T_HTMLBOX_COACH; ?> '><?php echo $lng->getTrn('menu/login'); ?> </h3> <div class='boxBody'> <form method="POST" action="<?php echo getFormAction(''); ?> "> <?php echo $lng->getTrn('login/loginname'); ?> <br> <input type="text" name="coach" size="20" maxlength="50"><br><br> <?php echo $lng->getTrn('login/passwd'); ?> <br> <input type="password" name="passwd" size="20" maxlength="50"> <div style='display: none;'><input type='text' name='hackForHittingEnterToLogin' size='1'></div> <br><br> <?php echo $lng->getTrn('login/remember'); ?> <input type='checkbox' name='remember' value='1'> <br><br> <input type="submit" name="login" value="<?php echo $lng->getTrn('login/loginbutton'); ?> "> </form> <br><br> <?php if (!Mobile::isMobile()) { if (Module::isRegistered('Registration') && $settings['allow_registration']) { echo "<a href='handler.php?type=registration'><b>Register</b></a>"; } echo "<br><br>"; echo "<a href='{$_URL_forgotpass}'><b>" . $lng->getTrn('login/forgotpass') . '</b></a>'; } ?> </div> </div> <?php } }
// Logout? if ($_VISSTATE['POST_OUT'] = isset($_GET['logout'])) { $_GET['section'] = 'main'; # Redirect logged out users to the main page. Coach::logout(); } if ($_VISSTATE['COOCKIE'] || $_VISSTATE['POST_IN'] || $_VISSTATE['POST_OUT']) { setupGlobalVars(T_SETUP_GLOBAL_VARS__POST_COACH_LOGINOUT); } HTMLOUT::frame_begin(isset($_SESSION['logged_in']) ? $coach->settings['theme'] : $settings['stylesheet']); # Make page frame, banner and menu. MTS('Header loaded, login auth, html frame generated'); // Check if a menu-link was picked, and execute section code from sections.php accordingly. switch ($_GET['section']) { case 'login': sec_login(); break; case 'admin': sec_admin(); break; case 'teamlist': sec_teamlist(); break; case 'coachlist': sec_coachlist(); break; case 'rules': sec_rules(); break; case 'about': sec_about();
if (!$config->var_online_user_count || $config->var_online_user_time + 30 < SN_TIME_NOW) { $config->db_saveItem('var_online_user_count', db_user_count(true)); $config->db_saveItem('var_online_user_time', SN_TIME_NOW); if ($config->server_log_online) { doquery("INSERT IGNORE INTO {{log_users_online}} SET online_count = {$config->var_online_user_count};"); } } // pdump($skip_fleet_update, '$skip_fleet_update'); // pdump($supernova->options['fleet_update_skip'], '$supernova->options[fleet_update_skip]'); global $skip_fleet_update; $skip_fleet_update = $skip_fleet_update || $supernova->options['fleet_update_skip'] || defined('IN_ADMIN'); if (!$skip_fleet_update && SN_TIME_NOW - strtotime($config->fleet_update_last) > $config->fleet_update_interval) { require_once SN_ROOT_PHYSICAL . "includes/includes/flt_flying_fleet_handler2" . DOT_PHP_EX; flt_flying_fleet_handler($skip_fleet_update); } sec_login($result); $user = $result[F_LOGIN_USER]; unset($result[F_LOGIN_USER]); $template_result += $result; unset($result); // В этой точке пользователь либо авторизирован - и есть его запись - либо пользователя гарантированно нет в базе // Если сообщение пустое - заполняем его по коду $template_result[F_LOGIN_MESSAGE] = isset($template_result[F_LOGIN_MESSAGE]) && $template_result[F_LOGIN_MESSAGE] ? $template_result[F_LOGIN_MESSAGE] : $lang['sys_login_messages'][$template_result[F_LOGIN_STATUS]]; // Это уже переключаемся на пользовательский язык с откатом до языка в параметрах запроса $lang->lng_switch(sys_get_param_str('lang')); global $dpath; $dpath = $user["dpath"] ? $user["dpath"] : DEFAULT_SKINPATH; $config->db_loadItem('game_disable') == GAME_DISABLE_INSTALL ? define('INSTALL_MODE', GAME_DISABLE_INSTALL) : false; if ($template_result[F_GAME_DISABLE] = $config->game_disable) { $template_result[F_GAME_DISABLE_REASON] = sys_bbcodeParse($config->game_disable == GAME_DISABLE_REASON ? $config->game_disable_reason : $lang['sys_game_disable_reason'][$config->game_disable]); if (defined('IN_API')) {