CodeIgniter Forums

Full Version: debugging a library server side
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]benmanson[/eluser]
Hi,

I am having some issues with SimpleLogin. I have a login script that works fine in Firefox but is failing to fire in Safari and IE. The validation is working fine so I have narrowed down the problem to the SimpleLogin side of things. I am not sure how to go about inserting either breakpoints or error code into the SimpleLogin library and then accessing that information in the browser. Can anyone suggest how I should go about doing it?

Also in case anyone can see something immediately wrong with my code, here is the controller:

Code:
function login() {
    
        $data['h1'] = 'cms login';
        $data['nomenu'] = 'y'; // hide menu as this is the login page

        
        // ---------------------------
        //       SET VALIDATION
        // ---------------------------
        $this->load->library('validation');
        
        // check incoming variables
        $rules['login_username'] = "required|min_length[4]|max_length[32]|alpha_dash";
        $rules['login_password'] = "required|min_length[4]|max_length[32]|alpha_dash";
        
        $this->validation->set_rules($rules);
        
        $fields['login_username'] = 'Username';
        $fields['login_password'] = 'Password';
        
        $this->validation->set_fields($fields);
        
        $this->validation->set_error_delimiters('<p id="error">','</p>');
        
        // ---------------------------
        //  RUN VALIDATION + SUBMIT DATA
        // ---------------------------
        
        if ($this->validation->run() == false) {
            // form fails to validate
            $data['status'] = "<p class=\"popfirst\">Please login in to the content management system below.</p>";
            $data['login'] = $this->load->view('cms/loginform','',true);
            $this->load->view('cms/cms_view',$data);
            
        } else {
            // form validates ok
            
            if($this->simplelogin->login($this->input->post('login_username'), $this->input->post('login_password'))) {
                // user logged in ok
                redirect('cms');
            
            } else {
                // failed to login
                redirect('cms/login');
            
            }
        }    
        
    
    } //ends login

Thanks
Ben

El Forum

[eluser]benmanson[/eluser]
OK I have narrowed it down to being a problem with this part of the SimpleLogin library:

Code:
$this->CI->session->sess_create();

On the server (running PHP4.4.2), the problem is occuring in Safari and IE but not happening in Firefox.

Locally using MAMP (PHP5.2.3) it doesn't occur in Safari.

Can anyone help?

cheers
Ben