[solved]Calling a function ??

#1
[eluser]Unknown[/eluser]
Hi,

I'm need some help as I've been working on an application in codeigniter and it is behaving strangely.


Code:
<?php

class Signup extends Controller {


function __construct(){
    
    $this->is_logged_in();

}


function index() {
    
    
    $this->load->view('signup_view');

}

function is_logged_in() {
    
        $is_logged_in = $this->session->userdata('is_logged_in');
    
        if(!isset($is_logged_in) || $is_logged_in != true)
     {
    
         echo ('This session is not logged in. Access Denied');
         echo ('<br />');
         echo anchor('login', 'Login', 'title="Login"');
         die();
    
     }
    
    
    }


function new_user() {

    $data = array(
    
        'first_name' => $this->input->post('first_name'),
        'last_name' => $this->input->post('last_name'),
        'email' => $this->input->post('email'),
        'address' => $this->input->post('address'),
        'city' => $this->input->post('city'),
        'province' => $this->input->post('province'),
        'country' => $this->input->post('country'),
        'postal' => $this->input->post('postal'),
        'phone' => $this->input->post('phone'),
        'cell_phone' => $this->input->post('cell_phone'),
        'other_phone' => $this->input->post('other_phone'),    
        'username' => $this->input->post('username'),
        'password' => md5($this->input->post('password')),
        'comments' => $this->input->post('comments'),
        'date_registered' => date("d/m/Y")
        
    );

    $this->load->model('users_model');
    $this->users_model->add_user($data);

}

function success() {
    
    $data['main_content'] = 'signup_success';
    $this->load->view('includes/template', $data);


}


}


I wanted to access the signup page from outside of being logged in I changed it so this:

Code:
&lt;?php

class Signup extends Controller {





function index() {
    
    
    $this->load->view('signup_view');

}

function is_logged_in() {
    
        $is_logged_in = $this->session->userdata('is_logged_in');
    
        if(!isset($is_logged_in) || $is_logged_in != true)
     {
    
         echo ('This session is not logged in. Access Denied');
         echo ('<br />');
         echo anchor('login', 'Login', 'title="Login"');
         die();
    
     }
    
    
    }


function new_user() {

    $data = array(
    
        'first_name' => $this->input->post('first_name'),
        'last_name' => $this->input->post('last_name'),
        'email' => $this->input->post('email'),
        'address' => $this->input->post('address'),
        'city' => $this->input->post('city'),
        'province' => $this->input->post('province'),
        'country' => $this->input->post('country'),
        'postal' => $this->input->post('postal'),
        'phone' => $this->input->post('phone'),
        'cell_phone' => $this->input->post('cell_phone'),
        'other_phone' => $this->input->post('other_phone'),    
        'username' => $this->input->post('username'),
        'password' => md5($this->input->post('password')),
        'comments' => $this->input->post('comments'),
        'date_registered' => date("d/m/Y")
        
    );

    $this->load->model('users_model');
    $this->users_model->add_user($data);

}

function success() {
    
    $data['main_content'] = 'signup_success';
    $this->load->view('includes/template', $data);


}


}


It still give the "This session is not logged in. Access Denied" message from the is_logged_in function. I even got rid of the function from this controller and it still generates that message as if it calls the function.

Any help would be greatly appreciated. I know I'm missing something simple.

#2
[eluser]Unknown[/eluser]
I just created a new test controller and set up a test_view and called it from the index() function on the controller and I'm getting a 404 message.

I'm not sure what I did but I can't even set up a new controller.

Help!!!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.