Welcome Guest, Not a member yet? Register   Sign In
undefined variable config
#1

[eluser]bigtimslim[/eluser]
When moving a working CI site to a friends mamp setup I get "undefined variable config"

This is at a line trying to load the encryption key. Everything else seems to be set up ok.

Any thoughts?
#2

[eluser]Xclamation Design[/eluser]
Did you get anywhere with this yet?

If not, could you copy/paste the full error message and also the file/code where it is being called and erroring?
#3

[eluser]bigtimslim[/eluser]
He ran the code in a virtual machine (vista) and it ran fine.

This is the error:

Severity: Notice
Message: Undefined Varibale: Config
Filename: Controllers/session.php
Line Number: 14

Code:
public function login()
    {
        $this->load->model('user_model');
        $this->user_model->username = $this->input->post('login_username');
        $password = sha1($config['encryption_key'].$this->input->post('login_password'));
        $this->user_model->password = $password;
        $user = $this->user_model->authenticate();
        if ($user)
        {
            $userdata = array(
                       'username'  => $user->username,
                       'email'     => $user->email,
                       'logged_in' => TRUE
            );
            $this->session->set_userdata($userdata);        
            redirect('nlc/events');                
        } else {
            $this->session->set_flashdata('flash', 'Username and/or password incorrect.');
            redirect('nlc');                        
        }
    }
#4

[eluser]Xclamation Design[/eluser]
Try changing the line from this:

Code:
$password = sha1($config['encryption_key'].$this->input->post('login_password'));

to this:

Code:
$password = sha1($this->config->item('encryption_key').$this->input->post('login_password'));

Let me know if the above helps at all...
#5

[eluser]bigtimslim[/eluser]
I had tried this and exact thing and when I do, no errors are produced, but the passwords no longer match. I guess if I re-entered everything with the new line, things would probably work out? I'm still confused though on why It works on my setup, but not his. I thought maybe some deal with global variables, but when we looked at our php settings, they seemed to match up.

Thank you for your help.
#6

[eluser]Xclamation Design[/eluser]
Have you checked to ensure that the encryption keys match on both installations/setups?

I did wondered whether your friends server has 'Display_Errors' turned on?

A good test, would be to create a new user and test that user can login on your friends setup. If you can create a user and login as that user then it should be ok...?

If you are still having problems, perhaps you could provide copies of both of your servers global settings/php.ini and copies of both your and your friends CodeIgniter config files?
#7

[eluser]Xclamation Design[/eluser]
Another test to try.

Simply re-assign the correct encryption key value from within your login function to see if that stops the error...
#8

[eluser]InsiteFX[/eluser]
Show your application/config/config.php config encryption key code!

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB