[eluser]CIfan1000[/eluser]
Hi guys!
I have the following simple library, it works fine without the constructor but when I put in the constructor I get:
Quote:Fatal error: Cannot access parent:: when current class scope has no parent in C:\Backup\Apache2.2\htdocs\CodeIgniter\system\application\libraries\Myauth.php on line 15
Any help would be very much appreciated!
Code:
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Myauth
{
// Create constructor to load CI libaries and helpers:
function Myauth()
{
parent::Controller();
}
function check_if_logged_in()
{
$CI =& get_instance();
$CI->load->library('session');
// Redirect user to login page if user is not authenticated:
if ($CI->session->userdata('UserStatus') != "Authenticated")
{
$CI->session->set_flashdata('title', 'Not logged in');
$CI->session->set_flashdata('message_title', 'Not logged in');
$CI->session->set_flashdata('message_body', 'In order to use this page you need to log in.');
redirect('message/message');
}
}
}
?>
Thanks!