01-26-2010, 09:59 AM
[eluser]sasori[/eluser]
hi this is my first time to try sessions of CI and im in trouble LOL
here's my controller code
model
view
when i try to log-in with a correct data, I'm just getting the
"you aren't logged in"
hi this is my first time to try sessions of CI and im in trouble LOL
here's my controller code
Code:
public function login()
{
$username = $_POST['username'];
$password = $_POST['passwd'];
$data['username'] = $this->session->set_userdata('username',$username);
$this->site_model->login($username,$password);
$this->load->view('member_view',$data);
}
model
Code:
public function login($username,$password)
{
$this->db->where('username',$username);
$this->db->where('passwd',$password);
$result = $this->db->get('user');
return $result;
}
view
Code:
<?php
if(isset($_SESSION['username'])){
echo "you are logged in as .". $_SESSION['username'];
}else{
echo "you aren't logged in";
}
?>
when i try to log-in with a correct data, I'm just getting the
"you aren't logged in"