Welcome Guest, Not a member yet? Register   Sign In
Fatal error :S
#1

[eluser]Unknown[/eluser]
Hi all,

I'm working on a login system but I get a fatal error in my model.
I autoloaded the session class in de autoload file.
I also already put values into the session, so i can't see why it isn't working.

The error:
Fatal error: Can't use method return value in write context in F:\Scripting Envoirment\Xampp\htdocs\Marketing site\application\models\login.php on line 15

Thanks in advance,
Paul du Long

model/login.php
Code:
<?php

class Login extends Model{
                    
    function Login(){
        parent::Model();
    }

    function setLvl($lvl)
    {
    
        if( isSet($lvl) )
        {
            
            if( isSet( $this -> session -> userdata('type') ) && isSet( $this -> session -> userdata('userid') ) )
            {
                
                if( $this -> session -> userdata('type') == $lvl )
                {
                    
                    define('userType', $this -> session -> userdata('type') );
                    define('userId', $this -> session -> userdata('userid') );
                    
                }else{
                    redirect('reLogin');
                }
                
            }else
            {
                redirect('reLogin');
            }
            
        }else
        {
            redirect('reLogin');
        }
    }
}

?>

controller/publishers.php
Code:
<?php

class Publishers extends Controller {

    function Publishers()
    {
        parent::Controller();    
        
        $this -> load -> model('login');
        $this -> login -> setLvl('1');
        
    }
    
    function index()
    {
        echo 'Userid: ' . userId .'<br/>';
        echo 'Type: ' . userType .'<br/>';
        
        //$this -> template -> load('modal','publishers');
        
    }
    
}
#2

[eluser]Johan André[/eluser]
I think $this->session->userdata('some_key') can't be used by the isset()-function.
#3

[eluser]Unknown[/eluser]
Thanks for your reply, i'll try it right away.

I tried it and it worked, no errors or anything.
#4

[eluser]Johan André[/eluser]
Great!




Theme © iAndrew 2016 - Forum software by © MyBB