Example #1
0
function Error($text)
{
    global $GlobalUser;
    if (!$GlobalUser) {
        $GlobalUser = array();
        $GlobalUser['player_id'] = 0;
    }
    $text = str_replace('\\"', """, $text);
    $text = str_replace('\'', "’", $text);
    $text = str_replace('\\`', "‘", $text);
    $now = time();
    $error = array(null, $GlobalUser['player_id'], $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'], $_SERVER['REQUEST_URI'], $text, $now);
    $id = AddDBRow($error, 'errors');
    Logout($_GET['session']);
    // Завершить сессию.
    ob_clean();
    // Отменить предыдущий HTML.
    PageHeader("error", true, false);
    echo "<center><font size=\"3\"><b>\n";
    echo "<br /><br />\n";
    echo "<font color=\"#FF0000\">Произошла ошибка</font> - {$text}\n";
    echo "<br /><br />\n";
    echo BackTrace() . "<br /><br />\n";
    echo "Аварийное завершение программы.<br/><br/>Обратитесь в Службу поддержки или на форум, в раздел \"Ошибки\".\n";
    echo "<br /><br />\n";
    echo "Error-ID: {$id}</b></font></center>\n";
    //PageFooter ();
    ob_end_flush();
    exit;
}
Example #2
0
function FacebookLogin($url)
{
    Logout();
    global $facebook;
    try {
        // Proceed knowing you have a logged in user who's authenticated.
        $user_profile = $facebook->api('/me');
        $facebookId = $user_profile['id'];
    } catch (FacebookApiException $e) {
        error_log($e);
        $user = null;
    }
    $loginInfo = DBFacebookUserLogin($facebookId);
    if ($loginInfo['ErrorCode'] == 0) {
        $_SESSION['UserID'] = $loginInfo['UserID'];
        $_SESSION['Email'] = $loginInfo['Email'];
        $_SESSION['UserName'] = $loginInfo['UserName'];
        $_SESSION['UserLevel'] = $loginInfo['UserLevel'];
        $_SESSION['IsFacebookUser'] = 1;
        $result['ResultCode'] = 0;
        $result['ResultMessage'] = 'Login Successful';
        header('Location: ' . $url);
    } else {
        $result['ResultCode'] = $loginInfo['ErrorCode'];
        $result['ResultMessage'] = $loginInfo['ErrorMessage'];
        FacebookSignUp($url);
    }
    //header('Location: ../#!/');
}
 function Login($username, $password)
 {
     $this->ulogin->Authenticate($username, $password);
     if ($this->ulogin->IsAuthSuccess()) {
         $user = $this->userDataAccessor->GetUserById($username);
         if ($user->userName == $username) {
             $_SESSION['HR'] = $user->isHR;
         } else {
             Logout();
             return false;
         }
         $_SESSION['uid'] = $this->ulogin->Uid();
         $_SESSION['loggedIn'] = true;
         return true;
     } else {
         return false;
     }
 }
Example #4
0
}
switch ($action) {
    case 'login':
        if ($zbp->user->ID > 0 && GetVars('redirect', 'GET')) {
            Redirect(GetVars('redirect', 'GET'));
        }
        if ($zbp->CheckRights('admin')) {
            Redirect('cmd.php?act=admin');
        }
        if ($zbp->user->ID == 0 && GetVars('redirect', 'GET')) {
            setcookie("redirect", GetVars('redirect', 'GET'), 0, $zbp->cookiespath);
        }
        Redirect('login.php');
        break;
    case 'logout':
        Logout();
        Redirect('../');
        break;
    case 'admin':
        Redirect('admin/?act=admin');
        break;
    case 'verify':
        if (VerifyLogin()) {
            if ($zbp->user->ID > 0 && GetVars('redirect', 'COOKIE')) {
                Redirect(GetVars('redirect', 'COOKIE'));
            }
            Redirect('admin/?act=admin');
        } else {
            Redirect('../');
        }
        break;
Example #5
0
<?php

// Выход
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
Logout($_GET['session']);
?>

<html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
 <link rel="stylesheet" type="text/css" href="<?php 
echo hostname();
?>
evolution/formate.css" />
  <meta http-equiv="refresh" content="3;URL=index.php" />
  <title>Logout</title>

</head>

<body topmargin='0' leftmargin='0' marginwidth='0' marginheight='0' >
<center>
До скорого!!<br />
<p>
             </p>
</center>
</body>
</html>
Example #6
0
function is_not_banned($forceCheck = false)
{
    global $txt, $modSettings, $context, $user_info;
    global $sourcedir, $cookiename, $user_settings, $smcFunc;
    // You cannot be banned if you are an admin - doesn't help if you log out.
    if ($user_info['is_admin']) {
        return;
    }
    // Only check the ban every so often. (to reduce load.)
    if ($forceCheck || !isset($_SESSION['ban']) || empty($modSettings['banLastUpdated']) || $_SESSION['ban']['last_checked'] < $modSettings['banLastUpdated'] || $_SESSION['ban']['id_member'] != $user_info['id'] || $_SESSION['ban']['ip'] != $user_info['ip'] || $_SESSION['ban']['ip2'] != $user_info['ip2'] || isset($user_info['email'], $_SESSION['ban']['email']) && $_SESSION['ban']['email'] != $user_info['email']) {
        // Innocent until proven guilty.  (but we know you are! :P)
        $_SESSION['ban'] = array('last_checked' => time(), 'id_member' => $user_info['id'], 'ip' => $user_info['ip'], 'ip2' => $user_info['ip2'], 'email' => $user_info['email']);
        $ban_query = array();
        $ban_query_vars = array('current_time' => time());
        $flag_is_activated = false;
        // Check both IP addresses.
        foreach (array('ip', 'ip2') as $ip_number) {
            // Check if we have a valid IP address.
            if (preg_match('/^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/', $user_info[$ip_number], $ip_parts) == 1) {
                $ban_query[] = '((' . $ip_parts[1] . ' BETWEEN bi.ip_low1 AND bi.ip_high1)
							AND (' . $ip_parts[2] . ' BETWEEN bi.ip_low2 AND bi.ip_high2)
							AND (' . $ip_parts[3] . ' BETWEEN bi.ip_low3 AND bi.ip_high3)
							AND (' . $ip_parts[4] . ' BETWEEN bi.ip_low4 AND bi.ip_high4))';
                // IP was valid, maybe there's also a hostname...
                if (empty($modSettings['disableHostnameLookup'])) {
                    $hostname = host_from_ip($user_info[$ip_number]);
                    if (strlen($hostname) > 0) {
                        $ban_query[] = '({string:hostname} LIKE bi.hostname)';
                        $ban_query_vars['hostname'] = $hostname;
                    }
                }
            } elseif ($user_info['ip'] == 'unknown') {
                $ban_query[] = '(bi.ip_low1 = 255 AND bi.ip_high1 = 255
							AND bi.ip_low2 = 255 AND bi.ip_high2 = 255
							AND bi.ip_low3 = 255 AND bi.ip_high3 = 255
							AND bi.ip_low4 = 255 AND bi.ip_high4 = 255)';
            }
        }
        // Is their email address banned?
        if (strlen($user_info['email']) != 0) {
            $ban_query[] = '({string:email} LIKE bi.email_address)';
            $ban_query_vars['email'] = $user_info['email'];
        }
        // How about this user?
        if (!$user_info['is_guest'] && !empty($user_info['id'])) {
            $ban_query[] = 'bi.id_member = {int:id_member}';
            $ban_query_vars['id_member'] = $user_info['id'];
        }
        // Check the ban, if there's information.
        if (!empty($ban_query)) {
            $restrictions = array('cannot_access', 'cannot_login', 'cannot_post', 'cannot_register');
            $request = $smcFunc['db_query']('', '
				SELECT bi.id_ban, bi.email_address, bi.id_member, bg.cannot_access, bg.cannot_register,
					bg.cannot_post, bg.cannot_login, bg.reason, IFNULL(bg.expire_time, 0) AS expire_time
				FROM {db_prefix}ban_items AS bi
					INNER JOIN {db_prefix}ban_groups AS bg ON (bg.id_ban_group = bi.id_ban_group AND (bg.expire_time IS NULL OR bg.expire_time > {int:current_time}))
				WHERE
					(' . implode(' OR ', $ban_query) . ')', $ban_query_vars);
            // Store every type of ban that applies to you in your session.
            while ($row = $smcFunc['db_fetch_assoc']($request)) {
                foreach ($restrictions as $restriction) {
                    if (!empty($row[$restriction])) {
                        $_SESSION['ban'][$restriction]['reason'] = $row['reason'];
                        $_SESSION['ban'][$restriction]['ids'][] = $row['id_ban'];
                        if (!isset($_SESSION['ban']['expire_time']) || $_SESSION['ban']['expire_time'] != 0 && ($row['expire_time'] == 0 || $row['expire_time'] > $_SESSION['ban']['expire_time'])) {
                            $_SESSION['ban']['expire_time'] = $row['expire_time'];
                        }
                        if (!$user_info['is_guest'] && $restriction == 'cannot_access' && ($row['id_member'] == $user_info['id'] || $row['email_address'] == $user_info['email'])) {
                            $flag_is_activated = true;
                        }
                    }
                }
            }
            $smcFunc['db_free_result']($request);
        }
        // Mark the cannot_access and cannot_post bans as being 'hit'.
        if (isset($_SESSION['ban']['cannot_access']) || isset($_SESSION['ban']['cannot_post']) || isset($_SESSION['ban']['cannot_login'])) {
            log_ban(array_merge(isset($_SESSION['ban']['cannot_access']) ? $_SESSION['ban']['cannot_access']['ids'] : array(), isset($_SESSION['ban']['cannot_post']) ? $_SESSION['ban']['cannot_post']['ids'] : array(), isset($_SESSION['ban']['cannot_login']) ? $_SESSION['ban']['cannot_login']['ids'] : array()));
        }
        // If for whatever reason the is_activated flag seems wrong, do a little work to clear it up.
        if ($user_info['id'] && ($user_settings['is_activated'] >= 10 && !$flag_is_activated || $user_settings['is_activated'] < 10 && $flag_is_activated)) {
            require_once $sourcedir . '/ManageBans.php';
            updateBanMembers();
        }
    }
    // Hey, I know you! You're ehm...
    if (!isset($_SESSION['ban']['cannot_access']) && !empty($_COOKIE[$cookiename . '_'])) {
        $bans = explode(',', $_COOKIE[$cookiename . '_']);
        foreach ($bans as $key => $value) {
            $bans[$key] = (int) $value;
        }
        $request = $smcFunc['db_query']('', '
			SELECT bi.id_ban, bg.reason
			FROM {db_prefix}ban_items AS bi
				INNER JOIN {db_prefix}ban_groups AS bg ON (bg.id_ban_group = bi.id_ban_group)
			WHERE bi.id_ban IN ({array_int:ban_list})
				AND (bg.expire_time IS NULL OR bg.expire_time > {int:current_time})
				AND bg.cannot_access = {int:cannot_access}
			LIMIT ' . count($bans), array('cannot_access' => 1, 'ban_list' => $bans, 'current_time' => time()));
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            $_SESSION['ban']['cannot_access']['ids'][] = $row['id_ban'];
            $_SESSION['ban']['cannot_access']['reason'] = $row['reason'];
        }
        $smcFunc['db_free_result']($request);
        // My mistake. Next time better.
        if (!isset($_SESSION['ban']['cannot_access'])) {
            require_once $sourcedir . '/Subs-Auth.php';
            $cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
            setcookie($cookiename . '_', '', time() - 3600, $cookie_url[1], $cookie_url[0], 0);
        }
    }
    // If you're fully banned, it's end of the story for you.
    if (isset($_SESSION['ban']['cannot_access'])) {
        // We don't wanna see you!
        if (!$user_info['is_guest']) {
            $smcFunc['db_query']('', '
				DELETE FROM {db_prefix}log_online
				WHERE id_member = {int:current_member}', array('current_member' => $user_info['id']));
        }
        // 'Log' the user out.  Can't have any funny business... (save the name!)
        $old_name = isset($user_info['name']) && $user_info['name'] != '' ? $user_info['name'] : $txt['guest_title'];
        $user_info['name'] = '';
        $user_info['username'] = '';
        $user_info['is_guest'] = true;
        $user_info['is_admin'] = false;
        $user_info['permissions'] = array();
        $user_info['id'] = 0;
        $context['user'] = array('id' => 0, 'username' => '', 'name' => $txt['guest_title'], 'is_guest' => true, 'is_logged' => false, 'is_admin' => false, 'is_mod' => false, 'can_mod' => false, 'language' => $user_info['language']);
        // A goodbye present.
        require_once $sourcedir . '/Subs-Auth.php';
        $cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
        setcookie($cookiename . '_', implode(',', $_SESSION['ban']['cannot_access']['ids']), time() + 3153600, $cookie_url[1], $cookie_url[0], 0);
        // Don't scare anyone, now.
        $_GET['action'] = '';
        $_GET['board'] = '';
        $_GET['topic'] = '';
        writeLog(true);
        // You banned, sucka!
        fatal_error(sprintf($txt['your_ban'], $old_name) . (empty($_SESSION['ban']['cannot_access']['reason']) ? '' : '<br />' . $_SESSION['ban']['cannot_access']['reason']) . '<br />' . (!empty($_SESSION['ban']['expire_time']) ? sprintf($txt['your_ban_expires'], timeformat($_SESSION['ban']['expire_time'], false)) : $txt['your_ban_expires_never']), 'user');
        // If we get here, something's gone wrong.... but let's try anyway.
        trigger_error('Hacking attempt...', E_USER_ERROR);
    } elseif (isset($_SESSION['ban']['cannot_login']) && !$user_info['is_guest']) {
        // We don't wanna see you!
        $smcFunc['db_query']('', '
			DELETE FROM {db_prefix}log_online
			WHERE id_member = {int:current_member}', array('current_member' => $user_info['id']));
        // 'Log' the user out.  Can't have any funny business... (save the name!)
        $old_name = isset($user_info['name']) && $user_info['name'] != '' ? $user_info['name'] : $txt['guest_title'];
        $user_info['name'] = '';
        $user_info['username'] = '';
        $user_info['is_guest'] = true;
        $user_info['is_admin'] = false;
        $user_info['permissions'] = array();
        $user_info['id'] = 0;
        $context['user'] = array('id' => 0, 'username' => '', 'name' => $txt['guest_title'], 'is_guest' => true, 'is_logged' => false, 'is_admin' => false, 'is_mod' => false, 'can_mod' => false, 'language' => $user_info['language']);
        // SMF's Wipe 'n Clean(r) erases all traces.
        $_GET['action'] = '';
        $_GET['board'] = '';
        $_GET['topic'] = '';
        writeLog(true);
        require_once $sourcedir . '/LogInOut.php';
        Logout(true, false);
        fatal_error(sprintf($txt['your_ban'], $old_name) . (empty($_SESSION['ban']['cannot_login']['reason']) ? '' : '<br />' . $_SESSION['ban']['cannot_login']['reason']) . '<br />' . (!empty($_SESSION['ban']['expire_time']) ? sprintf($txt['your_ban_expires'], timeformat($_SESSION['ban']['expire_time'], false)) : $txt['your_ban_expires_never']) . '<br />' . $txt['ban_continue_browse'], 'user');
    }
    // Fix up the banning permissions.
    if (isset($user_info['permissions'])) {
        banPermissions();
    }
}
Example #7
0
function Pad_Logout()
{
    Logout();
    Redirect('?mod=pad');
    die;
}
Example #8
0
             if (strlen($_POST['newpass1']) < 8) {
                 $OptionsError = loca("OPTIONS_ERR_PASS_8");
             } else {
                 if ($GlobalUser['password'] !== md5($_POST['db_password'] . $db_secret)) {
                     $OptionsError = loca("OPTIONS_ERR_OLDPASS");
                 }
             }
         }
     }
     if ($OptionsError === "") {
         $md5 = md5($_POST['newpass1'] . $db_secret);
         $query = "UPDATE " . $db_prefix . "users SET password = '******' WHERE player_id = " . intval($GlobalUser['player_id']);
         dbquery($query);
         $OptionsError = loca("OPTIONS_MSG_PASS");
         // TODO: OPTIONS_MSG_UNSAFE, OPTIONS_MSG_SIMPLE
         Logout($GlobalUser['session']);
     }
 } else {
     if ($_POST['db_email'] !== $GlobalUser['pemail'] && $_POST['db_email'] !== "") {
         // Сменить адрес
         $email = $_POST['db_email'];
         if ($GlobalUser['password'] !== md5($_POST['db_password'] . $db_secret)) {
             $OptionsError = loca("OPTIONS_ERR_NEEDPASS");
         } else {
             if (!isValidEmail($email)) {
                 $OptionsError = loca("OPTIONS_ERR_EMAIL");
             } else {
                 if (IsEmailExist($email)) {
                     $OptionsError = loca("OPTIONS_ERR_EMAILUSED");
                 }
             }
Example #9
0
    } else {
        return "";
    }
}
function Logout()
{
    // destroy the session
    session_destroy();
    return "Cierre De Sesion Existoso";
}
$possible_url = array("session", "login", "logout");
$value = "An error has occurred";
if (isset($_GET["action"]) && in_array($_GET["action"], $possible_url)) {
    switch ($_GET["action"]) {
        case "session":
            $value = session();
            break;
        case "logout":
            $value = Logout();
            break;
        case "login":
            if (isset($_GET["id"])) {
                $value = DoLogin($_GET["id"]);
            } else {
                $value = "Missing argument";
            }
            break;
    }
}
//return JSON array
exit(json_encode($value));
Example #10
0
function Change_PWUN_response($PWUN, $msg)
{
    //**********************************
    //Update $USERNAME or $HASHWORD. Default $page = changepw or changeun
    global $_, $ONESCRIPT, $USERNAME, $HASHWORD, $EX, $message, $page, $ONESCRIPT_file, $ONESCRIPT_file_backup, $CONFIG_FILE, $CONFIG_FILE_backup, $VALID_CONFIG_FILE;
    // trim white-space from input values
    $current_pass = trim($_POST['password']);
    $new_pwun = trim($_POST['new1']);
    $confirm_pwun = trim($_POST['new2']);
    $error_msg = $EX . '<b>' . hsc($msg) . '</b> ';
    //If all fields are blank, do nothing.
    if ($current_pass == "" && $new_pwun == "" && $confirm_pwun == "") {
        return;
    } elseif ($current_pass == "" || $new_pwun == "" || $confirm_pwun == "") {
        $message .= $error_msg . hsc($_['change_pw_07']) . '<br>';
    } elseif ($new_pwun != $confirm_pwun) {
        $message .= $error_msg . hsc($_['change_pw_04']) . '<br>';
    } elseif (hashit($current_pass) != $HASHWORD) {
        $message .= $error_msg . '<br>' . hsc($_['change_pw_03']) . '<br>';
        Logout();
    } else {
        if ($PWUN == "pw") {
            $search_for = '$HASHWORD ';
            //include space after $HASHWORD
            $replace_with = '$HASHWORD = "' . hashit($new_pwun) . '";';
            $success_msg = '<b>' . hsc($_['change_pw_01']) . '</b>';
        } else {
            //$PWUN = "un"
            $search_for = '$USERNAME ';
            //include space after $USERNAME
            $replace_with = '$USERNAME = "******";';
            $success_msg = '<b>' . hsc($_['change_un_01']) . '</b>';
        }
        //If specified & it exists, update external config file.
        if ($VALID_CONFIG_FILE) {
            $message .= $_['change_pw_05'] . ' ' . $_['change_pw_06'] . '. . . ';
            $updated = Update_config($search_for, $replace_with, $CONFIG_FILE, $CONFIG_FILE_backup);
        } else {
            //Update OneFileCMS
            $message .= $_['change_pw_05'] . ' OneFileCMS . . . ';
            $updated = Update_config($search_for, $replace_with, $ONESCRIPT_file, $ONESCRIPT_file_backup);
        }
        if ($updated === false) {
            $message .= $error_msg . '<br>';
        } else {
            $message .= $success_msg . '<br>';
        }
        $page = "admin";
        //Return to Admin page.
    }
}
Example #11
0
 private function TestIfIsToReject($Status)
 {
     if ($Status == 'Rejected ' or $Status == 'Banned') {
         //LogStr("Force Logout GAMEOVER", "Login");
         Logout();
         die(" You can't use this site anymore");
     }
 }
Example #12
0
function is_not_banned($forceCheck = false)
{
    global $txt, $db_prefix, $ID_MEMBER, $modSettings, $context, $user_info;
    global $sourcedir, $cookiename, $user_settings;
    // You cannot be banned if you are an admin - doesn't help if you log out.
    if ($user_info['is_admin']) {
        return;
    }
    // Only check the ban every so often. (to reduce load.)
    if ($forceCheck || !isset($_SESSION['ban']) || empty($modSettings['banLastUpdated']) || $_SESSION['ban']['last_checked'] < $modSettings['banLastUpdated'] || $_SESSION['ban']['ID_MEMBER'] != $ID_MEMBER || $_SESSION['ban']['ip'] != $user_info['ip'] || $_SESSION['ban']['ip2'] != $user_info['ip2'] || isset($user_info['email'], $_SESSION['ban']['email']) && $_SESSION['ban']['email'] != $user_info['email']) {
        // Innocent until proven guilty.  (but we know you are! :P)
        $_SESSION['ban'] = array('last_checked' => time(), 'ID_MEMBER' => $ID_MEMBER, 'ip' => $user_info['ip'], 'ip2' => $user_info['ip2'], 'email' => $user_info['email']);
        $ban_query = array();
        $flag_is_activated = false;
        // Check both IP addresses.
        foreach (array('ip', 'ip2') as $ip_number) {
            // Check if we have a valid IP address.
            if (preg_match('/^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/', $user_info[$ip_number], $ip_parts) == 1) {
                $ban_query[] = "(({$ip_parts['1']} BETWEEN bi.ip_low1 AND bi.ip_high1)\n\t\t\t\t\t\t\tAND ({$ip_parts['2']} BETWEEN bi.ip_low2 AND bi.ip_high2)\n\t\t\t\t\t\t\tAND ({$ip_parts['3']} BETWEEN bi.ip_low3 AND bi.ip_high3)\n\t\t\t\t\t\t\tAND ({$ip_parts['4']} BETWEEN bi.ip_low4 AND bi.ip_high4))";
                // IP was valid, maybe there's also a hostname...
                if (empty($modSettings['disableHostnameLookup'])) {
                    $hostname = host_from_ip($user_info[$ip_number]);
                    if (strlen($hostname) > 0) {
                        $ban_query[] = "('" . addslashes($hostname) . "' LIKE bi.hostname)";
                    }
                }
            } elseif ($user_info[$ip_number] == 'unknown') {
                $ban_query[] = "(bi.ip_low1 = 255 AND bi.ip_high1 = 255\n\t\t\t\t\t\t\tAND bi.ip_low2 = 255 AND bi.ip_high2 = 255\n\t\t\t\t\t\t\tAND bi.ip_low3 = 255 AND bi.ip_high3 = 255\n\t\t\t\t\t\t\tAND bi.ip_low4 = 255 AND bi.ip_high4 = 255)";
            }
        }
        // Is their email address banned?
        if (strlen($user_info['email']) != 0) {
            $ban_query[] = "('" . addslashes($user_info['email']) . "' LIKE bi.email_address)";
        }
        // How about this user?
        if (!$user_info['is_guest'] && !empty($ID_MEMBER)) {
            $ban_query[] = "bi.ID_MEMBER = {$ID_MEMBER}";
        }
        // Check the ban, if there's information.
        if (!empty($ban_query)) {
            $restrictions = array('cannot_access', 'cannot_login', 'cannot_post', 'cannot_register');
            $request = db_query("\n\t\t\t\tSELECT bi.ID_BAN, bi.email_address, bi.ID_MEMBER, bg.cannot_access, bg.cannot_register,\n\t\t\t\t\tbg.cannot_post, bg.cannot_login, bg.reason\n\t\t\t\tFROM ({$db_prefix}ban_groups AS bg, {$db_prefix}ban_items AS bi)\n\t\t\t\tWHERE bg.ID_BAN_GROUP = bi.ID_BAN_GROUP\n\t\t\t\t\tAND (bg.expire_time IS NULL OR bg.expire_time > " . time() . ")\n\t\t\t\t\tAND (" . implode(' OR ', $ban_query) . ')', __FILE__, __LINE__);
            // Store every type of ban that applies to you in your session.
            while ($row = mysql_fetch_assoc($request)) {
                foreach ($restrictions as $restriction) {
                    if (!empty($row[$restriction])) {
                        $_SESSION['ban'][$restriction]['reason'] = $row['reason'];
                        $_SESSION['ban'][$restriction]['ids'][] = $row['ID_BAN'];
                        if (!$user_info['is_guest'] && $restriction == 'cannot_access' && ($row['ID_MEMBER'] == $ID_MEMBER || $row['email_address'] == $user_info['email'])) {
                            $flag_is_activated = true;
                        }
                    }
                }
            }
            mysql_free_result($request);
        }
        // Mark the cannot_access and cannot_post bans as being 'hit'.
        if (isset($_SESSION['ban']['cannot_access']) || isset($_SESSION['ban']['cannot_post'])) {
            log_ban(array_merge(isset($_SESSION['ban']['cannot_access']) ? $_SESSION['ban']['cannot_access']['ids'] : array(), isset($_SESSION['ban']['cannot_post']) ? $_SESSION['ban']['cannot_post']['ids'] : array()));
        }
        // If for whatever reason the is_activated flag seems wrong, do a little work to clear it up.
        if ($ID_MEMBER && ($user_settings['is_activated'] >= 10 && !$flag_is_activated || $user_settings['is_activated'] < 10 && $flag_is_activated)) {
            require_once $sourcedir . '/ManageBans.php';
            updateBanMembers();
        }
    }
    // Hey, I know you! You're ehm...
    if (!isset($_SESSION['ban']['cannot_access']) && !empty($_COOKIE[$cookiename . '_'])) {
        $bans = explode(',', $_COOKIE[$cookiename . '_']);
        foreach ($bans as $key => $value) {
            $bans[$key] = (int) $value;
        }
        $request = db_query("\n\t\t\tSELECT bi.ID_BAN, bg.reason\n\t\t\tFROM ({$db_prefix}ban_items AS bi, {$db_prefix}ban_groups AS bg)\n\t\t\tWHERE bg.ID_BAN_GROUP = bi.ID_BAN_GROUP\n\t\t\t\tAND (bg.expire_time IS NULL OR bg.expire_time > " . time() . ")\n\t\t\t\tAND bg.cannot_access = 1\n\t\t\t\tAND bi.ID_BAN IN (" . implode(', ', $bans) . ")\n\t\t\tLIMIT " . count($bans), __FILE__, __LINE__);
        while ($row = mysql_fetch_assoc($request)) {
            $_SESSION['ban']['cannot_access']['ids'][] = $row['ID_BAN'];
            $_SESSION['ban']['cannot_access']['reason'] = $row['reason'];
        }
        mysql_free_result($request);
        // My mistake. Next time better.
        if (!isset($_SESSION['ban']['cannot_access'])) {
            require_once $sourcedir . '/Subs-Auth.php';
            $cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
            setcookie($cookiename . '_', '', time() - 3600, $cookie_url[1], $cookie_url[0], 0);
        }
    }
    // If you're fully banned, it's end of the story for you.
    if (isset($_SESSION['ban']['cannot_access'])) {
        // We don't wanna see you!
        if (!$user_info['is_guest']) {
            db_query("\n\t\t\t\tDELETE FROM {$db_prefix}log_online\n\t\t\t\tWHERE ID_MEMBER = {$ID_MEMBER}\n\t\t\t\tLIMIT 1", __FILE__, __LINE__);
        }
        // 'Log' the user out.  Can't have any funny business... (save the name!)
        $old_name = isset($user_info['name']) && $user_info['name'] != '' ? $user_info['name'] : $txt[28];
        $user_info['name'] = '';
        $user_info['username'] = '';
        $user_info['is_guest'] = true;
        $user_info['is_admin'] = false;
        $user_info['permissions'] = array();
        $ID_MEMBER = 0;
        $context['user'] = array('id' => 0, 'username' => '', 'name' => $txt[28], 'is_guest' => true, 'is_logged' => false, 'is_admin' => false, 'is_mod' => false, 'language' => $user_info['language']);
        // A goodbye present.
        require_once $sourcedir . '/Subs-Auth.php';
        $cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
        setcookie($cookiename . '_', implode(',', $_SESSION['ban']['cannot_access']['ids']), time() + 3153600, $cookie_url[1], $cookie_url[0], 0);
        // Don't scare anyone, now.
        $_GET['action'] = '';
        $_GET['board'] = '';
        $_GET['topic'] = '';
        writeLog(true);
        // You banned, sucka!
        fatal_error(sprintf($txt[430], $old_name) . (empty($_SESSION['ban']['cannot_access']['reason']) ? '' : '<br />' . $_SESSION['ban']['cannot_access']['reason']));
        // If we get here, something's gone wrong.... but let's try anyway.
        trigger_error('Hacking attempt...', E_USER_ERROR);
    } elseif (isset($_SESSION['ban']['cannot_login']) && !$user_info['is_guest']) {
        // !!! Why doesn't this use the function made for logging bans?
        db_query("\n\t\t\tUPDATE {$db_prefix}ban_items\n\t\t\tSET hits = hits + 1\n\t\t\tWHERE ID_BAN IN (" . implode(', ', $_SESSION['ban']['cannot_login']['ids']) . ')', __FILE__, __LINE__);
        // Log this ban.
        db_query("\n\t\t\tINSERT INTO {$db_prefix}log_banned\n\t\t\t\t(ID_MEMBER, ip, email, logTime)\n\t\t\tVALUES ({$ID_MEMBER}, SUBSTRING('{$user_info['ip']}', 1, 16), SUBSTRING('{$user_info['email']}', 1, 255), " . time() . ')', __FILE__, __LINE__);
        // SMF's Wipe 'n Clean(r) erases all traces.
        $_GET['action'] = '';
        $_GET['board'] = '';
        $_GET['topic'] = '';
        writeLog(true);
        // Logged in, but not for long...
        require_once $sourcedir . '/LogInOut.php';
        Logout(true);
    }
    // Fix up the banning permissions.
    if (isset($user_info['permissions'])) {
        banPermissions();
    }
}
Example #13
0
$this->head();
?>
</head>
<body>
    <?php 
$this->beginBody();
?>
    <div class="wrap">
        <?php 
NavBar::begin(['brandLabel' => 'My Company', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$menuItems = [['label' => Yii::t('app', 'Home'), 'url' => ['/site/index']], ['label' => Yii::t('app', 'About'), 'url' => ['/site/about']], ['label' => Yii::t('app', 'Contact'), 'url' => ['/site/contact']]];
if (Yii::$app->user->isGuest) {
    $menuItems[] = ['label' => Yii::t('app', 'Signup'), 'url' => ['/site/signup']];
    $menuItems[] = ['label' => Yii::t('app', 'Login'), 'url' => ['/site/login']];
} else {
    $menuItems[] = ['label' => Yii::t('app', Logout(' . Yii::$app->user->identity->username . ')), 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']];
}
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItems]);
NavBar::end();
?>

        <div class="container">
        <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
        <?php 
echo Alert::widget();
?>
        <?php 
echo $content;
?>