[eluser]huangxiao[/eluser]
Hi can i ask why is it when i am using
Quote:redirect()
the URL will be like this
Quote:http://localhost/test/index.php/login/lo...mbers_area
can you help me please why this happen and i always get "404 page not found"
Thank you in advance.
here is my code
login_view.php
Code:
<form class="login" acti method='post'>
<h2>Log-in</h2>
<input type='text' placeholder="username" class="input-block-level" name="username">
<input type='text' placeholder="password" class="input-block-level" name="password">
<button type="submit" class="btn btn-large btn-primary ">Log-in</button>
</form>
login.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Login extends CI_Controller{
function index(){
$data['maincontent'] = "login_view";
$this->load->view("include/template",$data);
}
function getlogin(){
$this->load->model('login_model');
$query = $this->login_model->login_check();
if($query){
$data = array(
'username'=>$this->input->post('username'),
'is_logged_in'=>true
);
$this->session->set_userdata($data);
redirect('success/members_area',location);
}else{
$this->index();
}
}
}
success.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Success extends CI_Controller{
function __construct(){
parent::__construct();
$this->is_logged_in();
}
function members_area(){
$this->load->view('members_area');
}
function is_logged_in(){
$this->session->userdata('is_logged_in');
if(is_logged_in != true){
echo "Not allowed";
}
}
}