• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Base url problem

#1
[eluser]Beg_student[/eluser]
hi every one ,i am beginner in CI and i need base_url() help in multiple pages
here is my problem

1.Action is my default controller and its funnction index() i called login.php and after posting the page my controller is redirect to member area and in member area i develop horizontal css menu and on click i call
<li><a href="&lt;?php echo base_url();?&gt;member/customer">customer</a></li>
i want to when i click payments its redirect to Payments controller becuase in payments have two tabies
1.view all record 2.add customer
but the problem which i face that when i redirect('customer') then url is going to change
http://localhost:90/BWebSite/site/Customer//Customer(method)
to
http://localhost:90/BWebSite/customer//customer(controller)
can any one give me idea, what should i do for that's problem?

here is my code
default controller
class Action extends CI_Controller
{
function __construct()
{
parent::__construct();
}

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

$this->form_validation->set_rules('txtuser','User Name ','trim|requeried|xss_clean');
$this->form_validation->set_rules('password','Password ','trim|requeried|xss_clean');

$this->load->Model('Site_model');
//$this->Site_model->index();
if($this->form_validation->run()==FALSE)
{
$this->index();
}
else
{
extract($_POST);
$user_id = $this->Site_model->check_login($txtuser, $password);

if (! $user_id){
// login failed error

$this->session->set_flashdata('login_error', TRUE);
redirect('action/login');

//redirect('user/login');
}
else
{



$this->session->set_userdata(array(
'logged_in' => TRUE,
'user_id' => $user_id
));

redirect('action/men');
}

}
}
function men()
{
if ($this->session->userdata('logged_in'))
{
redirect('site');
}

}
function logout()
{
$this->session->set_userdata('logged_in',FALSE);
}

}

?&gt;

&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Site extends CI_Controller {

public function index()
{
$this->Customer();
}


public function Customer()
{
$this->load->model("Site_model");
redirect('customer',current_url());//here is my issue
$this->load->view("Site_header");
$this->load->view("site_nav");
$this->load->view("view_customer");
$this->load->view("site_footer");
}
}


my model
&lt;?php
class Site_model extends CI_Model
{

function check_login($username, $password)
{
$sha1_password = md5($password);

$query_str = "SELECT user_id FROM users WHERE username = ? and password = ?";

$result = $this->db->query($query_str, array($username, $sha1_password));

if ($result->num_rows() == 1)
{
return $result->row(0)->user_id;
}
else
{
return false;
}
}
}
?&gt;

hopefully you'll understand my code
thanks


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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