views:

33

answers:

1

Hi every one first of all im new in zend and i need some help to start.

My problem is I have a login for like this

<form action="<?php echo $this->baseUrl ?>/user/login" method="post" id="login">
    <input type="text" name="username" value=""/>
    <input type="password" name="password" value=""/>
    <input type="submit" name="submit" value="submit" />
</form>

and my controller is

Code: Select all public function loginAction() {

        if($this->request->isPost()){

            $f = new Zend_Filter_StripTags();
            $user = $f->filter($this->_request->getPost('username'));
            $pass1 = $f->filter($this->_request->getPost('password'));

            try {

                if(!empty ($user) && !empty ($pass1)){

                   $this->_redirect('/user/system');
                   $modelUser = new UserModel();
                   $data = $modelUser->authUser($username, $pass1);

                if($data->isValid()){
                        $this->view->isvalid = "valido";
                   }
                   $this->view->data = $data;

                    $this->_redirect('/user/system');

                }else {
                    return false;
                }



            } catch (Exception $exc) {
                MainHelper::writeLog("Problem Login Action". $exc);
            }



        }

and my model

    public function authUser($user , $pass)
    {
        $select = $this->select()
                ->from($_name)
                ->where('id_user = ?', $user)
                ->where('pass = ?', $pass );

        $row = $this->fetchRow($select);

        //if($row>0)
        return $row->toArray();

    }

My problem is when i try to login , the website is show me a blank page without code, whats wrong ? I know the controller and Model.

Thanks in advance

A: 

If you're getting a blank white page, there's probably some fatal error going on. You can turn on PHP's log_errors (to write the errors to a logfile), or display_errors (to output errors to the browser), and make sure error_reporting is set to some reasonable value.

If you followed the typical ZF QuickStart stuff, you can probably just make sure your application is using the "development" environment, which is usually set up to display errors properly. If not, you can hack index.php and the appropriate ini_set() and error_reporting() just before dispatch.

That should help you figure out what the immediate problem is.

Furthermore, it's not clear why you're calling $this->_redirect('/user/system'); before you try $data = $modelUser->authUser($username, $pass1);

But your first task is to configure your development environment so you can figure out what's causing fatal errors.

timdev