Welcome Guest, Not a member yet? Register   Sign In
Invisible pages, no output
#1

[eluser]richzilla[/eluser]
Hi all, ive been working through creating my own simple user auth system, and thanks to getting loads of help from here ive just about cracked it. Ive just come up against one final problem. Ill post my controller to demonstrate:

Code:
<?php
    class Site extends Controller {
    
        function index() {
            $this->load->view('site_view');
        }
        
        function login() {
            $this->form_validation->set_rules('username','User Name', 'required|xss_clean');
            $this->form_validation->set_rules('password','Password','required|xss_clean');
            
            $this->form_validation->set_error_delimiters('<div class="error">','</div>');
            
            $data = array (
            'userName' => $this->input->post('username'),
            'userPass' => $this->input->post('password')
            );
            
            if ($this->form_validation->run() == FALSE) {
                $this->index();
            }
            else {
                
                $this->db->where('userName',$data['userName']);
                $this->db->where('userPass',$data['userPass']);
                $query = $this->db->get('users');

                $result = $query->result();
                
                if (isset($result)) {
                    foreach($result as $row) :
                        $this->session->set_userdata(array('loggedIn' => TRUE, 'userId' => $row->id, 'userName' => $row->userName));
                        $this->secure();
                    endforeach;
                }
            ***    else {
                    $err = array (
                    'error' => "The entered credentials were incorrect"
                    );
                    $this->load->view('site_view', $err);
                }
            }
        
        }
        
        function secure() {
            $data = array (
            'uName' => $this->session->userdata('userName')
            );
            $this->load->view('secure_page', $data);
        }
        
        function logout() {
            $this->session->sess_destroy();
            $this->load->view('site_view');
        }
    
    }

everything works fine until i enter valid, but incorrect login details (ive starred the line where i think the problem is). The page returned is completely blank, nothing in the source either so there is just no output. it comes back with a 200 code in the header so its not a server problem. I wondered if anyone could point out the mistake?

thanks again for the help.


Messages In This Thread
Invisible pages, no output - by El Forum - 09-03-2009, 03:20 AM
Invisible pages, no output - by El Forum - 09-03-2009, 03:25 AM
Invisible pages, no output - by El Forum - 09-03-2009, 03:59 AM
Invisible pages, no output - by El Forum - 09-03-2009, 04:39 AM
Invisible pages, no output - by El Forum - 09-03-2009, 04:47 AM
Invisible pages, no output - by El Forum - 09-03-2009, 05:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB