本文整理汇总了PHP中UserDao::get方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDao::get方法的具体用法?PHP UserDao::get怎么用?PHP UserDao::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDao
的用法示例。
在下文中一共展示了UserDao::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
/**
* @param <type> $username
* @param <type> $password
* @return boolean
*/
public function login($username, $password)
{
$user = new User(null, $username, $password);
$user = $this->userDao->get($user);
if ($user != null) {
Session::login($user);
setcookie('Bureau_PosicaoApps', '', time() - 3600);
//setcookie('Bureau_PosicaoApps', "publicacoes|noticias|videoteca", time() + 3600);
setcookie('Bureau_PosicaoApps', $user->getPositions(), time() + 3600);
setcookie('Bureau_AppsMinimizados', "0", Config::get('tempo_vida_cookie'));
setcookie('logged', '1', time() + 10);
return true;
}
return false;
}
示例2: authenticate
/**
* Authenticates the given username and password against the database,
* Logs the user in and returns a user object on success, otherwise returns false
* @param <type> $username
* @param <type> $password
* @return <type>
*/
public function authenticate($username, $password)
{
// Find the user in the db
$dao = UserDao::get();
$user = $dao->findByUsername($username);
// Perform validation
if ($user == NULL || self::getHash($password, $user->Password) !== $user->Password) {
return false;
} else {
// update information, such as login count and last login
$dao->updateLoginInfo($user->UserId);
$this->_user = $user;
// complete the login
$this->_login();
return $user;
}
}
示例3: header
if (!isset($_SESSION)) {
session_start();
}
if (isset($_SESSION['connected'])) {
header("Location: index.php");
exit;
}
$courrier = "Courriel";
$message = "";
if (isset($_REQUEST['courriel'])) {
$courriel = $_REQUEST['courriel'];
$motDePasse = $_REQUEST['motDePasse'];
require_once '/code/classes/UserDao.php';
require_once '/code/classes/User.php';
$dao = new UserDao();
$u = $dao->get($courriel);
if ($u == NULL) {
$message = $courriel . ' introuvable';
} else {
if ($u->getMotDePasse() != $_REQUEST['motDePasse']) {
$message = "Mot de passe érroné";
} else {
$_SESSION['connected'] = $u->getNom();
header("Location: admin.php");
exit;
}
}
}
?>
<!DOCTYPE html>
<html lang="en"><head>