Answer the question
In order to leave comments, you need to log in
How to solve error_too_many_redirects in codeigniter?
There is a small site on codeigniter, everything seems to work, but (not on all) on some devices, when entering the admin panel, it displays an error_too_many_redirects error. I tried it myself even through vpn, from different devices, I didn’t come across this, the login function itself is primitive, what could be the problem? Maybe the problem is in the server settings? Here is the controller
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class User extends MY_Admin
{
protected $data = array();
function __construct()
{
parent::__construct();
$this->load->model('AdminModel');
}
public function index()
{
if (!$this->logged_in) {
header("Location: /admin_folder/user/login");
return false;
}
return $this->load->view('/admin_folder/index');
}
public function login()
{
if ($this->logged_in) {
header("Location: /admin_folder/user/login");
return false;
}
if (isset($_POST['password']) && isset($_POST['login']) &&
!empty($_POST['password']) && !empty($_POST['password'])) {
$data = array(
'login' => htmlspecialchars($_POST['login']),
'password' => md5($_POST['password'])
);
$check = $this->AdminModel->check_login($data);
if ($check) {
$_SESSION['user_data'] = $data;
header("Refresh:0");
} else {
$data['response'] = 'login or password wrong';
}
} else {
$data['response'] = '';
}
return $this->load->view('/admin_folder/login', $data);
}
public function logout()
{
session_destroy();
header("Location: /admin_folder/user/login");
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question