Welcome Guest, Not a member yet? Register   Sign In
A Few Hook Questions
#1

[eluser]xtremer360[/eluser]
I'm trying to figure out a few things like:

1. If this is the properly written hook file.
2. I keep getting errors like these:

Code:
Severity: Notice
Message: Trying to get property of non-object
Filename: hooks/Sys_prescript.php
Line Number: 10

Fatal error: Call to a member function fetch_class() on a non-object in /public_html/application/hooks/Sys_prescript.php on line 10

Code:
<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');
class Sys_prescript {
    private $CI;
    function initial_run()
    {
        $this->CI =& get_instance();
        $public_access = array('login', 'registration');
        $current_class = $this -> CI -> router -> fetch_class();
        $session_data = $this -> session -> userdata('user_id');
        if ($session_data == FALSE)
        {
            if (!in_array($current_class, $public_access))
            {
                redirect('login', 'refresh');
            }
        }
        else
        {
        }
    }
}


Messages In This Thread
A Few Hook Questions - by El Forum - 02-06-2014, 12:35 PM
A Few Hook Questions - by El Forum - 02-06-2014, 01:10 PM
A Few Hook Questions - by El Forum - 02-06-2014, 01:12 PM
A Few Hook Questions - by El Forum - 02-06-2014, 01:14 PM
A Few Hook Questions - by El Forum - 02-06-2014, 01:16 PM
A Few Hook Questions - by El Forum - 02-06-2014, 01:24 PM
A Few Hook Questions - by El Forum - 02-06-2014, 01:33 PM
A Few Hook Questions - by El Forum - 02-06-2014, 02:10 PM
A Few Hook Questions - by El Forum - 02-06-2014, 02:14 PM
A Few Hook Questions - by El Forum - 02-06-2014, 02:19 PM
A Few Hook Questions - by El Forum - 02-06-2014, 02:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB