本文整理汇总了PHP中auth::register方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::register方法的具体用法?PHP auth::register怎么用?PHP auth::register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auth
的用法示例。
在下文中一共展示了auth::register方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addUser
/**
* 添加用户
*/
function addUser()
{
$role_list = $this->user->roleList('state=1');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($this->user->userExist($_POST['username'])) {
$this->error('用户名已经存在!');
}
if (!empty($_POST['email']) && $this->user->emailExist($_POST['email'])) {
$this->error('Email已经存在!');
}
$auth_class = new auth();
C('AUTH_EMAIL_ACTIVATE', FALSE);
//关闭电子邮件激活
if ($auth_class->register($_POST)) {
$this->success('添加成功');
}
}
$this->assign('role_list', $role_list);
$this->display();
}
示例2: auth
<?php
require_once './../persistence.class.php';
require_once './../auth.class.php';
$uid = "eddadmin";
$pass = "root";
$userData = ['FirstName' => 'dont', 'LastName' => 'fail', 'Username' => 'this', 'Email' => 'unit', 'Gender' => 'test'];
$auth = new auth($uid);
$user = $auth->register($uid, $pass, $userData);
$status = $user->authenticated() ? "Sucess" : $user->fail_reason();
echo $status;
示例3: dirname
<?php
require dirname(__FILE__) . '/../dbConnection.php';
require dirname(__FILE__) . '/../lib/auth.class.php';
$auth = new auth();
$username = $_POST["email"];
$email = $username;
$password = $_POST["password"];
$reEntryPassword = $password;
$currency = $_POST["currency"];
$auth->register($username, $password, $reEntryPassword, $email, $currency);
示例4:
<input type="password" name="pass" placeholder="Пароль" required>
<input type="submit" name="login" value="Авторизироваться!">
</form>
<a href="?action=register">Register</a>
';
}
if (isset($_GET['action']) and $_GET['action'] == 'logout') {
//logouting
$user->logout();
}
if (isset($_POST['login'])) {
//logging
if ($user->login($_POST['nick'], $_POST['pass'])) {
} else {
echo $user->error_msg;
}
}
if (isset($_POST['register'])) {
//registering
if ($user->register($_POST['nick'], $_POST['email'], $_POST['pass'], $_POST['r_pass'], $_POST['name'])) {
} else {
echo $user->error_msg;
}
}
if (isset($_POST['check'])) {
//validating
if (!$user->verify($_POST['code'])) {
echo $user->error_msg;
}
}
include 'footer.php';