| Server IP : 213.186.33.2 / Your IP : 216.73.216.39 Web Server : Apache System : Linux webm005.cluster102.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : symetry ( 21728) PHP Version : 8.2.31 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/symetry/www/ARCHIVES/application/controllers/ |
Upload File : |
<?php
/** @see Zend_Controller_Action */
require_once 'Zend/Controller/Action.php';
class AuthController extends Zend_Controller_Action
{
function init()
{
$this->initView();
$this->view->baseUrl = $this->_request->getBaseUrl();
}
function indexAction()
{
$this->_redirect('/Index/Profile');
}
public function loginAction()
{
$this->view->message = '';
if ($this->_request->isPost()) {
// collect the data from the user
Zend_Loader::loadClass('Zend_Filter_StripTags');
$f = new Zend_Filter_StripTags();
$username = $f->filter($this->_request->getPost('username'));
$password = $f->filter($this->_request->getPost('password'));
if (empty($username)) {
$this->view->message = Zend_registry::get('translate')->_('UserNameRequired');
} else {
// setup Zend_Auth adapter for a database table
Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable');
$dbAdapter = Zend_Registry::get('db');
$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
$authAdapter->setTableName('users');
$authAdapter->setIdentityColumn('usr_username');
$authAdapter->setCredentialColumn('usr_password');
// Set the input credential values to authenticate against
$authAdapter->setIdentity($username);
$authAdapter->setCredential($password);
// do the authentication
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($authAdapter);
if ($result->isValid()) {
// success: store database row to auth's storage
// system. (Not the password though!)
$data = $authAdapter->getResultRowObject(null, 'password');
$auth->getStorage()->write($data);
$this->_redirect('/Index/Profile');
} else {
// failure: clear database row from session
$this->view->message = Zend_registry::get('translate')->_('LoginFailed');
}
}
}
$this->view->title = "LoginPage";
$this->render();
}
public function logoutAction()
{
Zend_Auth::getInstance()->clearIdentity();
$this->_redirect('/Index/Profile');
}
public function testauthAction()
{
$auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity()) {
$this->view->message = Zend_registry::get('translate')->_('AuthentifiedFailed');
}
else
{
$this->view->message = Zend_registry::get('translate')->_('Authentified');
}
}
}