当前位置: 首页>>代码示例>>PHP>>正文


PHP AdminHandler::init方法代码示例

本文整理汇总了PHP中AdminHandler::init方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminHandler::init方法的具体用法?PHP AdminHandler::init怎么用?PHP AdminHandler::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AdminHandler的用法示例。


在下文中一共展示了AdminHandler::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setcookie

 if ($lang != check_language(0)) {
     # only set cookie if language selection was changed
     setcookie('lang', $lang, time() + 60 * 60 * 24 * 30);
     # language cookie, lifetime 30 days
     # (language preference cookie is processed even if username and/or password are invalid)
 }
 $h = new AdminHandler();
 if ($h->login($fUsername, $fPassword)) {
     session_regenerate_id();
     $_SESSION['sessid'] = array();
     $_SESSION['sessid']['roles'] = array();
     $_SESSION['sessid']['roles'][] = 'admin';
     $_SESSION['sessid']['username'] = $fUsername;
     $_SESSION['PFA_token'] = md5(uniqid(rand(), true));
     # they've logged in, so see if they are a domain admin, as well.
     if (!$h->init($fUsername)) {
         flash_error($PALANG['pLogin_failed']);
     }
     if (!$h->view()) {
         flash_error($PALANG['pLogin_failed']);
     }
     $adminproperties = $h->result();
     if ($adminproperties['superadmin'] == 1) {
         $_SESSION['sessid']['roles'][] = 'global-admin';
     }
     header("Location: main.php");
     exit(0);
 } else {
     # $h->login failed
     error_log("PostfixAdmin login failed (username: {$fUsername})");
     flash_error($PALANG['pLogin_failed']);
开发者ID:mpietruschka,项目名称:postfixadmin,代码行数:31,代码来源:login.php

示例2: create_admin

function create_admin($values)
{
    DEFINE('POSTFIXADMIN_SETUP', 1);
    # avoids instant redirect to login.php after creating the admin
    $handler = new AdminHandler(1, 'setup.php');
    $formconf = $handler->webformConfig();
    if (!$handler->init($values['username'])) {
        return array(1, "", $handler->errormsg);
    }
    if (!$handler->set($values)) {
        return array(1, "", $handler->errormsg);
    }
    if (!$handler->store()) {
        return array(1, "", $handler->errormsg);
    }
    return array(0, $handler->infomsg['success'], array());
}
开发者ID:skamayker,项目名称:docker_mail,代码行数:17,代码来源:setup.php


注:本文中的AdminHandler::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。