當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserList::getCount方法代碼示例

本文整理匯總了PHP中UserList::getCount方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserList::getCount方法的具體用法?PHP UserList::getCount怎麽用?PHP UserList::getCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserList的用法示例。


在下文中一共展示了UserList::getCount方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ahref

<?php

/**
 * This is the user manager
 */
//TODO: fix up row coloring with YuiDatatable
namespace cd;

$session->requireAdmin();
echo '<h1>Manage users</h1>';
echo 'All users: ' . ahref('a/users/', UserList::getCount()) . '<br/>';
echo 'Users online: ' . ahref('a/users/?online', UserList::onlineCount()) . '<br/>';
$filter = '';
if (!empty($_POST['usearch'])) {
    $filter = $_POST['usearch'];
}
echo '<br/>';
echo xhtmlForm('usearch_frm');
echo 'Username filter: ' . xhtmlInput('usearch');
echo xhtmlSubmit('Search');
echo xhtmlFormClose();
echo '<br/>';
if (isset($_GET['online'])) {
    $list = UserList::getUsersOnline($filter);
    echo '<h2>Showing all users online';
} else {
    $list = UserList::getUsers($filter);
    echo '<h2>Showing all users';
}
if ($filter) {
    echo ', matching <u>' . $filter . '</u>';
開發者ID:martinlindhe,項目名稱:core_dev,代碼行數:31,代碼來源:users.php

示例2:

<?php

/**
 * Register user view
 *
 * DIRECTLY INCLUDED FROM session_login.php
 */
//STATUS: wip
//XXX XHR för att se om användarnamn är ledigt
//XXX js som visuellt visar password strength & "dont match" medans man skriver
//TODO: send account activation mail
//XXX use XhtmlForm class, it needs a way to show the images first. also needs a way to show multiple buttons
namespace cd;

$superadmin_reg = !UserList::getCount();
if (!$superadmin_reg && !$session->allow_registrations) {
    return;
}
// Handle new user registrations
if (isset($_POST['register_usr']) && isset($_POST['register_pwd']) && isset($_POST['register_pwd2'])) {
    $reg = UserHandler::getInstance();
    $user_id = $reg->register($_POST['register_usr'], $_POST['register_pwd'], $_POST['register_pwd2']);
    if ($user_id) {
        if ($superadmin_reg) {
            if (!UserGroup::getAll()) {
                // If no UserGroup:s exist, create them
                UserGroup::create('Webmasters', 1);
                UserGroup::create('Admins', 2);
                $sadmin_id = UserGroup::create('Super Admins', 3);
            } else {
                $grp = UserGroup::getByName('Super Admins');
開發者ID:martinlindhe,項目名稱:core_dev,代碼行數:31,代碼來源:register.php

示例3: ViewModel

/**
 * Shows a login form with tabs for Register & Forgot password functions
 */
//STATUS: wip
//TODO: make facebook javascript login code work
//TODO cosmetic: mark input field for username or password with a color if empty in validate_login_form()
namespace cd;

if ($session->id || $session->facebook_id) {
    return;
}
$login_div = 'login_div';
$reg_div = 'reg_div';
$recover_div = 'recover_div';
// only show "register user" if initial setup or if config allows it
$show_reg_div = !UserList::getCount() || $session->allow_logins && $session->allow_registrations;
// only show "recover password" if mail server is configured
$show_recover_div = SendMail::getInstance()->getServer() ? true : false;
if ($show_reg_div) {
    // this must be included here so registration handling can happen first
    echo '<div id="' . $reg_div . '" style="display:none;">';
    include 'register.php';
    echo '</div>';
}
if ($show_recover_div) {
    echo '<div id="' . $recover_div . '" style="display:none;">';
    include 'forgot_pwd.php';
    echo '</div>';
}
// include js validation snippets
$view = new ViewModel('views/core/js_validation.php');
開發者ID:martinlindhe,項目名稱:core_dev,代碼行數:31,代碼來源:login.php


注:本文中的UserList::getCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。