daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest May 23rd, 2018 153 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.  
  4. public function indexAction()
  5.   {
  6.     // Zend form
  7.     $loginForm = new My_Form_Login($_POST);
  8.  
  9.     // Post/get submit values
  10.     $user = $this->getRequest()->getParam('username');
  11.     $pass = $this->getRequest()->getParam('password');
  12.  
  13.     // Check if the form valid
  14.     if (isset($user) && isset($pass) ) {
  15.  
  16.       // Database connection
  17.       $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', 'production');
  18.       $db = Zend_Db::factory($config->resources->db);
  19.       $this->db = $db;
  20.    
  21.       // Database coonnect >> Tables > Field1 , Field 2
  22.       $adapter = new Zend_Auth_Adapter_DbTable(
  23.                     $db,
  24.                     'clients',
  25.                     'email',
  26.                     'nickname'
  27.                     );
  28.      
  29.       // Search username password
  30.       $adapter->setIdentity($user);
  31.       $adapter->setCredential($pass);
  32.  
  33.       // Submit search
  34.       $result = $adapter->authenticate();
  35.  
  36.       // login success fail route
  37.       if ($result->isValid()) {
  38.  
  39.         /**
  40.          * Successfully loged in
  41.          *
  42.          */
  43.         $rows       = new Application_Model_Clients();
  44.         $dbsession  = $rows->give_sessions($user);
  45.         $mysession  = new Zend_Session_Namespace('mysession');
  46.         $mysession->rows = $dbsession;
  47.  
  48.         if ($mysession->rows['clienttype']=='lezer') {
  49.           $this->_redirect('/login/surferaccount');
  50.         } else {
  51.           $this->_redirect('/login/myaccount');
  52.         }
  53.  
  54.        
  55.       } else {
  56.        
  57.         echo 'Invalid username/password. Please try again with valid information.';
  58.  
  59.       }
  60.  
  61.     }
  62.  
  63.      echo $loginForm;
  64.      
  65.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top