1
I’m having problems, I had created a codeigniter application on my localhost, had the windows 10 operating system installed and used Wamp Server installed, but I formatted my computer and installed Linux as operating system and installed Xampp on the machine, however now I can not login to the application, I tested the models and controllers to see and it is all right, test us via which when authenticating the email and password is returning the user usually but is not adding in the Section.
Follows controller code (Login.php):
class Login extends CI_Controller {
function index() {
if($this->session->userdata('isLoggedIn')) {
redirect('/painel/acesso');
} else {
$this->show_login();
}
}
function login_user() {
$this->load->model('Login_model');
$email = $this->input->post('email');
$password = sha1($this->input->post('password'));
$usuario = $this->Login_model->logar($email, $password);
if($usuario){
$this->session->set_userdata('isLoggedIn', $usuario);
$this->session->set_flashdata('success','Login efetuado com sucesso, seja bem vindo.');
redirect('/painel/acesso');
}else{
$this->session->set_flashdata('error','E-mail ou senha invalidas');
redirect('/login');
}
}
Follows Model code (Login_model.php):
class Login_model extends CI_Model {
public function logar($email, $password){
$this->db->where('email', $email);
$this->db->where('password', $password);
$usuario = $this->db->get('user')->row_array();
return $usuario;
}
}
OBS: Remembering that this error started when I migrated to Ubuntu
then, only that I took a look at the file "/opt/lampp/etc/php.ini" and on the line Session.save_path="/opt/lampp/temp/" is saving the session files in this folder, at least that’s what I understand, in this folder /opt/lampp/temp/ are being saved the files with name similar to this :
ci_session03d59bd3750fd71051bf4ad894e98a20
But I realized they’re coming with the jammed signal, and it’s not possible to read, unless I’m allowed in the terminal with "sudo chmod -R 777 temp", then I can read and the file.see that returns yes with the message from success:Success|s:43:"Login successfully", welcome." But I don’t understand why it’s being blocked
Most likely it is the session files that are not being recorded. Take a look at config.php within config on the line where you have the configuration of $config['sess_save_path']. Perform the configuration of this PATH or, in php.ini enter the configuration of Session.save_path. It is usually within /tmp.
– Bruno Rigolon