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


PHP users::create方法代码示例

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


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

示例1: register

 public function register($arguments)
 {
     // Create
     if (Session::isLoggedIn()) {
         return Error::set('You can\'t register if you\'re logged in!');
     }
     $this->view['valid'] = true;
     $this->view['publicKey'] = Config::get('recaptcha:publicKey');
     if (!empty($arguments) && $arguments[0] == 'save') {
         if (empty($_POST['recaptcha_challenge_field']) || empty($_POST['recaptcha_response_field'])) {
             return Error::set('We could not find the captcha validation fields!');
         }
         $recaptcha = Recaptcha::check($_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
         if (is_string($recaptcha)) {
             return Error::set(Recaptcha::$errors[$recaptcha]);
         }
         if (empty($_POST['username']) || empty($_POST['password']) || empty($_POST['email'])) {
             return Error::set('All forms are required.');
         }
         $users = new users(ConnectionFactory::get('mongo'));
         $hideEmail = empty($_POST['hideEmail']) ? false : true;
         $created = $users->create($_POST['username'], $_POST['password'], $_POST['email'], $hideEmail, null, true);
         if (is_string($created)) {
             return Error::set($created);
         }
         $users->authenticate($_POST['username'], $_POST['password']);
         header('Location: ' . Url::format('/'));
     }
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:29,代码来源:user.php

示例2: import

 /**
  * Import an account.
  * 
  * @param string $username The username to use.
  * @param string $password The password to use.
  */
 public function import($username, $password)
 {
     $data = $this->get($username);
     $this->db->remove(array('username' => $this->clean($username)));
     $users = new users(ConnectionFactory::get('mongo'));
     $id = $users->create($username, $password, $data['email'], $data['hideEmail'], $this->groups[$data['mgroup']], true);
     $newRef = MongoDBRef::create('users', $id);
     $oldRef = MongoDBRef::create('unimportedUsers', $data['_id']);
     $this->mongo->news->update(array('user' => $oldRef), array('$set' => array('user' => $newRef)));
     $this->mongo->articles->update(array('user' => $oldRef), array('$set' => array('user' => $newRef)));
     self::ApcPurge('get', $data['_id']);
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:18,代码来源:reclaims.php

示例3: array_merge

    }
    $data['roles'] = users::getRoles($dbh);
    if (is_array($_SESSION['token'])) {
        $data = array_merge($data, $_SESSION['token']);
    }
    $app->render('adminUserShow.html', $data);
});
$app->get('/admin/users/setStat/:userID/:status', $authenticateAdmin, function ($userID, $status) use($app) {
    $dbh = getConnection();
    users::setStatus($dbh, $userID, $status);
    die;
});
$app->post('/admin/users/New/', $authenticateAdmin, function () use($app) {
    $dbh = getConnection();
    $userData = $app->request->post();
    users::create($dbh, $userData);
    die;
});
$app->post('/admin/users/:userID/', $authenticateAdmin, function ($userID) use($app) {
    $dbh = getConnection();
    $userData = $app->request->post();
    users::update($dbh, $userID, $userData);
    die;
});
$app->get('/admin/users/setRole/:userID/:roleID/', $authenticateAdmin, function ($userID, $roleID) use($app) {
    $dbh = getConnection();
    users::setRole($dbh, $userID, $roleID);
    die;
});
$app->get('/admin/users/del/:userID/', $authenticateAdmin, function ($userID) use($app) {
    $dbh = getConnection();
开发者ID:nbunney,项目名称:fulferSite,代码行数:31,代码来源:admin.php


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