Controller_member
function login () {
$data['content_view']='v_form_login.php';
$this->load->view ('v_template',$data);
$username = $this->input->post('username');
$password =($this->input->post('password'));
$login_status = $this->m_member->validasi ($username, $password);
if ($login_status) {
$this->session->set_userdata('ses_username', $username);
$this->session->set_userdata('ses_login_status', $login_status);
redirect ('c_member/index');
}
}
Model_member
public function validasi ($username, $password){
$sql = "SELECT * FROM member WHERE username = '$username' AND password = '$password'";
$result = $this->db->query($sql);
$ketemu = $result->num_rows;
if($ketemu>0){
return true;
}else{
return false;
}
}
Model_slide
function delete_data($id){
$delete_date=$this->input->post('delete_date');
$query=$this->db->query("UPDATE slide SET delete_date=NOW() WHERE id='$id'");
}
我想从login_by是登录用户名的登录用户保存会话。