Welcome Guest, Not a member yet? Register   Sign In
Passing variables to the function as parameters - throwing error
#1

[eluser]Adam_R[/eluser]
I have an authorization library which looks like:

Code:
class Auth {
    // properties
    var $CI;
var $encrypt_pass;
    var $redirect_to;
    var $_login_var = 'email';
    var $_password_var = 'password';
var $_permissions;

    
    function Auth()
    {
        $this->CI =& get_instance();
  $this->encrypt_pass = FALSE;
        $this->redirect_to = 'login';
        $this->hash_key = $this->CI->config->item('auth_hash');
    }

    
    function Authorize($permission_category = 1, $permission)
    {
       //here is a code to authorize users
     }

When I will try to use

Code:
$this->auth->Authorize();

or

Code:
$this->auth->Authorize('userlist');

I'm getting error:

Code:
Message: Missing argument 2 for Auth::Authorize(), called in /controllers/admin.php on line 57 and defined

Filename: libraries/auth.php

Line Number: 31

Shouldn't in a first case use argument 1: $permission_category = 1 and an empty $permission as argument 2? Then in a second case argument 1 be $permission_category = 1 and argument 2 $permission = 'userlist' ?

I'm little bit lost there.

Thanks



Messages In This Thread
Passing variables to the function as parameters - throwing error - by El Forum - 11-16-2012, 09:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB