本文整理汇总了PHP中UsersPeer::doSelectOne方法的典型用法代码示例。如果您正苦于以下问题:PHP UsersPeer::doSelectOne方法的具体用法?PHP UsersPeer::doSelectOne怎么用?PHP UsersPeer::doSelectOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UsersPeer
的用法示例。
在下文中一共展示了UsersPeer::doSelectOne方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
$uid = $this->getRequestParameter('uid');
$conf = $this->getRequestParameter('conf');
$c = new Criteria();
$c->add(UsersPeer::USER_ID, $uid);
$user = UsersPeer::doSelectOne($c);
if (sha1($user->getSalt() . $user->getUsername()) == $conf) {
$this->goodConf = true;
$user->setActive('Y');
$user->save();
} else {
$this->goodConf = false;
}
}
示例2: executeLogin
public function executeLogin()
{
$c = new Criteria();
$c->add(UsersPeer::USER_NAME, $this->getRequestParameter('login'));
$c->add(UsersPeer::USER_PWD, $this->getRequestParameter('password'));
$user_record = UsersPeer::doSelectOne($c);
if ($user_record) {
$this->getUser()->setAuthenticated(true);
$c = new Criteria();
$c->add(RolePeer::ID, $user_record->getRoleId());
$user_role = RolePeer::doSelectOne($c);
$this->getUser()->addCredential($user_role->getRoleName());
return $this->redirect('users');
} else {
$this->getRequest()->setError('login', 'incorrect entry');
return $this->forward('security', 'index');
}
}
示例3: getUsers
/**
* Get the associated Users object
*
* @param PropelPDO Optional Connection object.
* @return Users The associated Users object.
* @throws PropelException
*/
public function getUsers(PropelPDO $con = null)
{
if ($this->aUsers === null && $this->user_id !== null) {
$c = new Criteria(UsersPeer::DATABASE_NAME);
$c->add(UsersPeer::USER_ID, $this->user_id);
$this->aUsers = UsersPeer::doSelectOne($c, $con);
// Because this foreign key represents a one-to-one relationship, we will create a bi-directional association.
$this->aUsers->setUserInformation($this);
}
return $this->aUsers;
}
示例4: getUsers
/**
* Get the associated Users object
*
* @param PropelPDO Optional Connection object.
* @return Users The associated Users object.
* @throws PropelException
*/
public function getUsers(PropelPDO $con = null)
{
if ($this->aUsers === null && $this->user_id !== null) {
$c = new Criteria(UsersPeer::DATABASE_NAME);
$c->add(UsersPeer::USER_ID, $this->user_id);
$this->aUsers = UsersPeer::doSelectOne($c, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->aUsers->addUserRidess($this);
*/
}
return $this->aUsers;
}
示例5: executeForgot
public function executeForgot()
{
if ($this->getRequest()->getMethod() != sfRequest::POST) {
$this->emailSent = false;
// display the form
$this->getRequest()->setAttribute('referer', $this->getRequest()->getReferer());
} else {
// handle the form submission
$nickname = $this->getRequestParameter('nickname');
$c = new Criteria();
$c->add(UsersPeer::USERNAME, $nickname);
$user = UsersPeer::doSelectOne($c);
// nickname exists?
if ($user) {
$password = substr(md5(rand(100000, 999999)), 0, 6);
$user->saltPassword($password);
$user->save();
$this->emailSent = true;
$this->sendPasswordMail($user->getUsername(), $user->getEmail(), $password);
} else {
$this->emailSent = false;
}
$this->getRequest()->setAttribute('referer', $this->getRequest()->getReferer());
}
}