Online PHP editor is going to be changed...

We are going to:

  1. Redesign the site
  2. Work with SSH instead of FTP
  3. Switch to HTTPS
  4. Work without "session" to improve security
  5. And, of course, remain open source

Please consider...

  1. Checking our new PHP blog
  2. Visit the new Facebook page


I'm using SSH and I will continue using online-php.com

<? Online-PHP::Tutorials ?>

« Back

  • ZF: Create the loginAction - receive login form, and authenticate.

    
    

    Example of a controller action for authenticating the request from the login form

    
        public function loginAction()
        {
            // check that this is POST request
            $req = $this->getRequest();
            if (!$req->isPost()) {
                $this->_redirect('/');
                return;
            }
    
            // get the database resource
            $db = Zend_Registry::getInstance()->get('db');
    
    
            // get POST parameters
            $login = $this->getParam('login');
            $password = $this->getParam('password');
    
            // define the adapter
            $authAdapter = new Zend_Auth_Adapter_DbTable($db);
            $authAdapter->setTableName('Users');
                ->setIdentityColumn('username');
                ->setCredentialColumn('password');
                ->setIdentity($login);
                ->setCredential($password);
                ->setCredentialTreatment('MD5(?)');
    
            // authenticate
            $auth = Zend_Auth::getInstance();
            $result = $auth->authenticate($authAdapter);
            if ($result->isValid()) {
                $data = $authAdapter->getResultRowObject(null, 'password'); // without password
                $auth->getStorage()->write($data);
            }
    
            $this->_redirect('/');
        }