本文整理汇总了PHP中UserDAO::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDAO::getUser方法的具体用法?PHP UserDAO::getUser怎么用?PHP UserDAO::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDAO
的用法示例。
在下文中一共展示了UserDAO::getUser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeNew
public function executeNew(sfWebRequest $request)
{
if ($request->getMethod() != "POST") {
return;
}
$this->username = $request->getPostParameter("username");
if (!$this->username) {
return $this->setErrorMsg("Username is a required field!");
}
$this->user = UserDAO::getUser($this->username);
if ($this->user) {
return $this->setErrorMsg("That username is already in use!");
}
$this->password1 = $request->getPostParameter("password1");
$this->password2 = $request->getPostParameter("password2");
if (!$this->password1 || !$this->password2) {
return $this->setErrorMsg("Password is a required field");
}
if ($this->password1 != $this->password2) {
return $this->setErrorMsg("Password and password confirm must match!");
}
$this->email = $request->getPostParameter("email");
$this->user = UserDAO::createUser($this->username, $this->password1, $this->email);
$this->login($this->user);
$this->redirect("dashboard/index");
}
示例2: UserDAO
function __construct()
{
session_start();
if (isset($_SESSION[AppConstants::SESSION_USER]) === false) {
$_SESSION[AppConstants::SESSION_USER] = '';
$_SESSION[AppConstants::SESSION_PASSWORD] = '';
}
$user = $_SESSION[AppConstants::SESSION_USER];
$pass = $_SESSION[AppConstants::SESSION_PASSWORD];
$userDao = new UserDAO();
$this->_user_USR = $userDao->getUser($user, $pass);
}
示例3: redirect_to
if (isset($_GET["status"])) {
$status = $_GET["status"];
if ($status == 0) {
$message = "password changed successfully";
} else {
if ($status == 1) {
$message = "password updation failed";
} else {
$message = "password cannot be more than 15char(s).";
}
}
}
if (!checkSession()) {
redirect_to("index.php");
}
$user = UserDAO::getUser($_SESSION["username"]);
if (isset($_POST["newPassword"])) {
if (strlen($newPassword) > 15) {
redirect_to("admin.php?status=2");
} else {
$user->password = $_POST["newPassword"];
UserDAO::changePassword($user);
redirect_to("admin.php?status=0");
}
}
} catch (Exception $exception) {
echo $exception->getMessage();
die;
}
include "partials/header.php";
?>
示例4: loginUser
public static function loginUser($email, $password)
{
$user = UserDAO::getUser($email);
if ($user && password_verify($password, $user->getPassword())) {
return $user;
} else {
return false;
}
}