So habe ich eine einfache Anmeldung entwickelt und Einfügen von Datenseiten mit CodeIgniter, ich möchte zu jedem Benutzer hat ihre eigenen Daten in DB und jeder Benutzer hat ihre eigenen Satz von DB. Mein Fokus hier ist, die Sitzung zuerst zu bekommen, weil ich die Sitzung von meinem Code nicht bekommen kann.PHP Sitzung MVC mit CodeIgniter
Ich bin neu in PHP und benutze nie PHP noch die native zuvor. Hier ist mein Controller:
public function login(){
$this->load->library('session');
$email = $this->input->post('email');
$password = $this->input->post('password');
log_message('error','isi email : '.$email);
log_message('error','isi password : '.$password);
$return = $this->welcome_model->checkLogin($email, $password);
if($return){
$this->session->set_userdata('email',$email);
$var = $this->session->userdata;
redirect('welcome/masuk');}
Modell:
public function checkLogin($email, $password)
{
$return = $this->db->get_where('login',array('email'=>$email, 'password' => $password));
if($return->result_array() != NULL){
return TRUE;
}else{
return FALSE;
}
}
Ausblick:
<form action="<?php echo base_url(); ?>welcome/login" method="post">
<input type="email" class="form-control" name="email" placeholder="Email">
<input type="password" class="form-control" name="password" placeholder="Password">
<button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button>
</form>
Jede Hilfe ist willkommen! Vielen Dank!
Es kann auf diese Frage keine wirkliche Antwort sein. Sie suchen im Grunde nach einer Codeüberprüfung, und dafür ist Stack Overflow nicht geeignet. –