本文整理汇总了PHP中Application_Model_User::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_User::select方法的具体用法?PHP Application_Model_User::select怎么用?PHP Application_Model_User::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Model_User
的用法示例。
在下文中一共展示了Application_Model_User::select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerAction
function registerAction()
{
$user = new Application_Model_User();
$this->view->form = new Application_Form_Register();
if ($this->_request->isPost()) {
Zend_Loader::loadClass('Zend_Filter_StripTags');
$filter = new Zend_Filter_StripTags();
$name = trim($filter->filter($this->_request->getPost('name')));
$pass = trim($filter->filter($this->_request->getPost('pass')));
$email = trim($filter->filter($this->_request->getPost('email')));
$pass = md5($pass);
$userRow = $user->fetchRow($user->select()->where('name = ?', $name));
//$userArray = $userRow->toArray();
if ($userRow != '') {
echo "User name already exist";
} else {
$userRow = $user->fetchRow($user->select()->where('email = ?', $email));
//$userArray = $userRow->toArray();
if ($userRow != '') {
echo "Email already exist";
} else {
if ($this->view->form->isValid($this->getRequest()->getPost())) {
$hash = md5(microtime());
$mail = new Zend_Mail();
$mail->setBodyText('Hello
Your email regisrated on website spitfire.mydev.org.ua
to confirm your account click link bellow
http://spitfire.mydev.org.ua/register/confirmuser/&hash=<');
$mail->setFrom('spitfire.net@gmail.com', 'Some Sender');
$mail->addTo('spitfire.ukr@gmail.com', 'Some Sender');
$mail->setSubject('TestSubject');
$mail->send();
if ($name != '' && $pass != '') {
$data = array('name' => $name, 'email' => $email, 'pass' => $pass);
$user->insert($data);
$this->_redirect('/');
return;
}
} else {
echo "Captcha wrong";
}
}
}
}
}
示例2: changepermissionAction
function changepermissionAction()
{
$this->view->title = "Change user permission";
$user = new Application_Model_User();
$id = (int) $this->_request->getParam('id');
$userRow = $user->fetchRow($user->select()->where('id = ?', $id));
$userArray = $userRow->toArray();
if ($userArray['permission'] == 0) {
$insertValue = "1";
}
if ($userArray['permission'] == 1) {
$insertValue = "0";
}
$data = array('permission' => $insertValue);
$where = 'id = ' . $id;
$user->update($data, $where);
$this->_redirect('/users');
return;
}
示例3: adminLoginAction
function adminLoginAction()
{
$this->view->title = "Login";
$form = new Application_Form_UserLoginForm();
$this->view->form = $form;
// Post and validation section
if (!$this->_request->isPost()) {
return;
}
$formData = $this->_request->getPost();
if (!$form->isValid($formData)) {
return;
}
$email = $formData['email'];
$password = $formData['password'];
//$password = md5($formData['password']);
$this->authAdapter->setTableName('users')->setIdentityColumn('email')->setCredentialColumn('pwd')->setIdentity($email)->setCredential($password);
$auth = Zend_Auth::getInstance();
$result = $this->authAdapter->authenticate();
if ($result->isValid()) {
$data = $this->authAdapter->getResultRowObject(null, 'pwd');
$auth->getStorage()->write($data);
//fetch user info
$user = new Application_Model_User();
$select = $user->select(array('user_id', 'user_name'))->where('email = ?', $email);
$row = $user->fetchRow($select);
$this->user_session = new Zend_Session_Namespace('user_session');
// default namespace
$this->user_session->user_name = $row->user_name;
$this->user_session->user_id = $row->user_id;
$this->_redirect('/admin/index');
} else {
$this->view->msg = "<div class='alert alert-danger'> Invalid User Name or Passowrd </div>";
$this->view->form = $form;
}
}