Controller of ZEND Reviewed by Momizat on . application/controllers/IndexController.php [php] <?php require_once 'Zend/Controller/Action.php'; require_once 'Zend/Registry.php'; class IndexController ex application/controllers/IndexController.php [php] <?php require_once 'Zend/Controller/Action.php'; require_once 'Zend/Registry.php'; class IndexController ex Rating: 0

Controller of ZEND

application/controllers/IndexController.php

<?php
require_once 'Zend/Controller/Action.php';
require_once 'Zend/Registry.php';

class IndexController extends Zend_Controller_Action
{

    public function init()
    {	
		$this->auth = new Zend_Session_Namespace('auther');
		$this->objfront = new Application_Model_DbTable_User();
		$messages = $this->_helper->flashMessenger->getMessages();
		if(!empty($messages)){
		$this->view->message = $messages[0];
		}
    }
	#------------menus start----------------
    public function indexAction()
    {
	$this->_helper->layout->setLayout('login');
	//$auth = new Zend_Session_Namespace('auther');		
	//$this->view->query_send=$auth->query_send;
	
       $objRequest	= $this->getRequest();
	   if($objRequest->isPost())	
		{
		$post = $objRequest->getPost();
		
		if(!empty($post['uname']) && !empty($post['psswd'])){
			$rec=$this->objfront->loginuser($post['uname'],$post['psswd']);	
			if(empty($rec)){
			$this->_helper->flashMessenger('Invalid Username / Password');
			$this->_helper->redirector->setGotoSimple("index","index"); 
			}else{
			$this->auth->userid=$rec['id'];
			//echo "<pre>";print_r($rec);exit;
			$this->_helper->redirector->setGotoSimple("index","admin"); 
			}
		}else{
			$this->_helper->flashMessenger('All fields Required!');
			$this->_helper->redirector->setGotoSimple("index","index"); 
		}
		
		}
    }
}
?>

Leave a Comment

© 2014 Powered By