Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- APPLICATION_PATH . '/application/config/application.ini
- resources.db.adapter = "Pdo_SQLite"
- resources.db.params.dbname = APPLICATION_PATH "/data/db/zftraining.db"
- resources.db.isDefaultTableAdapter = true
- **/
- public function authAction()
- {
- // I love Zend Framework - MyPassword01
- $salt = 'I love Zend Framework';
- $email = $this->getRequest()->getParam('email');
- $password = md5($salt . ' - ' . $this->getRequest()->getParam('password'));
- $bootstrap = $this->getInvokeArg('bootstrap');
- $db = $bootstrap->getResource('db');
- if ($db instanceof Zend_Db_Adapter_Abstract) {
- $db->getProfiler()->setEnabled(true);
- }
- $auth = new Zend_Auth_Adapter_DbTable($db);
- $auth->setTableName('member')
- ->setIdentityColumn('email')
- ->setCredentialColumn('password')
- ->setIdentity($email)
- ->setCredential($password);
- try {
- $result = $auth->authenticate();
- } catch (Zend_Auth_Exception $e) {
- echo $e->getMessage();
- }
- $this->view->messages = $result->getMessages();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement