コード例 #1
0
 public static function saveUnauthorizedAccess($checksum, $accountId)
 {
     if (isset($checksum) && isset($accountId)) {
         $db = db::getInstance();
         $stmt = $db->prepare('SELECT
                 count(tblAPIUnauthorizedAccess_accessId)
             AS
                 counter
             FROM
                 tblAPIUnauthorizedAccess
             WHERE
                 tblAPIUnauthorizedAccess_accountId = :aid');
         $stmt->bind_param('aid', $accountId);
         $stmt->execute();
         $result = $stmt->fetch_assoc();
         $stmt2 = $db->prepare('INSERT INTO
                 tblAPIUnauthorizedAccess
             SET
                 tblAPIUnauthorizedAccess_checksum = :csum,
                 tblAPIUnauthorizedAccess_accountId = :accId');
         $stmt2->bind_param('csum', $checksum);
         $stmt2->bind_param('accId', $accountId);
         $stmt2->execute();
         if ($result['counter'] >= 1) {
             Account::killSession();
             Account::banAccount($accountId);
             return 'banned';
         }
     }
 }
コード例 #2
0
        if ($account->loginUser($_POST) == false) {
            $smarty->assign('accountError', $account->getAccountError());
            $smarty->assign('content', 'account_login.tpl');
        } else {
            #die(var_dump($_POST));
            $_SESSION['account']['accountID'] = serialize($account->getAccountID());
            $_SESSION['account']['loginName'] = serialize($account->getLoginName());
            $_SESSION['account']['group'] = serialize($account->getGroup());
            $_SESSION['account']['checksum'] = serialize(\eCMS\Misc\miscellaneous::hasher(unserialize($_SESSION['account']['accountID']) . unserialize($_SESSION['account']['loginName'])));
            if (isset($_POST['stayLoggedIn'])) {
                setcookie('gerki[accountID]', serialize($account->getAccountID()), time() + 60 * 60 * 24 * 30);
                setcookie('gerki[loginName]', serialize($account->getLoginName()), time() + 60 * 60 * 24 * 30);
                setcookie('gerki[group]', serialize($account->getGroup()), time() + 60 * 60 * 24 * 30);
                $checksum = \eCMS\Misc\miscellaneous::hasher(unserialize($_SESSION['account']['accountID']) . unserialize($_SESSION['account']['loginName']));
                setcookie('gerki[checksum]', serialize($checksum), time() + 60 * 60 * 24 * 30);
                \eCMS\Account\Account::saveChecksum($checksum, $account->getAccountID(), $account->getLoginName());
            }
            header("Location: ?module=news");
        }
        $_POST = '';
    }
    $smarty->assign('account', $account);
}
if (isset($_GET['action']) && $_GET['action'] == 'logout') {
    $_SESSION = array();
    unset($_SESSION['account']);
    session_destroy();
    setcookie('gerki[accountID]', '', time() - 1);
    setcookie('gerki[loginName]', '', time() - 1);
    setcookie('gerki[group]', '', time() - 1);
    setcookie('gerki[checksum]', '', time() - 1);