Welcome Guest, Not a member yet? Register   Sign In
Fatal Error,Loopy code
#1

[eluser]Peterk[/eluser]
Code:
if(isset($this->validation->login_email))
{
    // do stuff
    } else {
        $login = get_cookie("remember_account");
        $login = $this->encrypt->decode($login);    // line 13
        $valid_login_email = $login;
        echo $valid_login_email." + ";
        }


being called here:
Code:
&lt;?=form_input($login_email,$valid_login_email)?&gt;</label></p><br />  // line 43

I know it's not "clean code" but I needed to do it the old fashioned way so I could follow the logic. It produces the error below, and I have no idea why. Any help?

Fatal error: Call to a member function decode() on a non-object in /codeigniter/system/application/views/forms/login_form.php on line 13
#2

[eluser]Craig A Rodway[/eluser]
Have you loaded the encryption library?
#3

[eluser]Peterk[/eluser]
Yes, I loaded it.
#4

[eluser]Peterk[/eluser]
basically what's happening is that I set a cookie with the pass/login encrypted. Then when the user clicks the "remember me" checkbox I use get_cookie('whatever') to grab that pass/login from the cookie.

Now what happens is that when the cookie is encrypted, it returns the encrypted values of "whatever_df84545345" , so that's what shows up in the text fields for pass/login.

When I decode the information in the cookie via:

$this->encrypt->decode(get_cookie('whatever')); it looks right in the pass/login text fields and works fine for established users.

Now when a NEW USER tries to sign up for the site, I get:

Fatal error: Call to a member function decode() on a non-object in codeigniter/system/application/views/forms/login_form.php on line 13

for whatever line I have this on: $this->encrypt->decode(get_cookie('whatever'));
#5

[eluser]Craig A Rodway[/eluser]
Try to see if the cookie has a value first, before you try to decode it.
#6

[eluser]Peterk[/eluser]
I'm going to leave this here in case someone runs into the same problem.

I needed to load the encrypt library in my new user registration class.

Since the code for existing users goes down one path, and the code for new users goes down another, you need to load the encrypt library in both classes. I only had it loaded in my existing users code path.

Thanks for the heads up Craig. Much appreciated.




Theme © iAndrew 2016 - Forum software by © MyBB