Note that there are some explanatory texts on larger screens.

plurals
  1. PORedirect Loop error in CodeIgniter
    primarykey
    data
    text
    <p>I worked on this for a day. I get this <a href="https://stackoverflow.com/questions/9157293/redirect-error-in-codeigniter">same problem</a>, but I don't understand.</p> <pre><code>&lt;?php class Users extends CI_Controller { function index() { redirect('Users/login'); } function login() { $data['title'] = 'Selamat datang di Sistem Informasi Koperasi'; $data['main_content'] = 'login'; $this-&gt;load-&gt;view('Users/template', $data); } function logout() { $this-&gt;session-&gt;sess_destroy(); $this-&gt;session-&gt;set_flashdata('info_login', 'Anda sudah keluar dari sistem'); redirect('Users/login'); } function validate() { //Load User Model $this-&gt;load-&gt;model('Users_Model'); //Validate User $query = $this-&gt;Users_Model-&gt;validate(); if($query != '') { //Mengambil Roles dari Groups $roles = $this-&gt;Users_Model-&gt;roles($query-&gt;group_id); //$this-&gt;login_model-&gt;last_login($query); $data = array( 'username' =&gt; $query-&gt;username, 'roles' =&gt; $roles, 'is_logged_in' =&gt; true ); $this-&gt;session-&gt;set_userdata($data); if($roles == 'administrators') { redirect('Administrators/index'); } elseif($roles == 'managers') { redirect('Managers/index'); } else { $this-&gt;session-&gt;set_flashdata('info_login', 'Mohon maaf anda belum terdaftar sebagai Group! Silahkan hubungi admin!'); redirect('Users/login'); } } else { $this-&gt;session-&gt;set_flashdata('info_login', 'Maaf,username dan password yang anda masukkan salah,silahkan coba kembali!'); redirect('Users/login'); } } } </code></pre> <p>In Chrome and Firefox I get this message. What should i do?</p> <blockquote> <p>This webpage has a redirect loop The webpage at <code>http://localhost/simpks/index.php/Users/login</code> has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer. Here are some suggestions: Reload this webpage later. Learn more about this problem. Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.</p> </blockquote> <p>this is my view template.php</p> <pre><code>&lt;?php $this-&gt;load-&gt;view('includes/header',$main_content); $this-&gt;load-&gt;view('Users/'.$main_content); $this-&gt;load-&gt;view('includes/footer'); ?&gt; </code></pre> <p>this is my model Users_Model.php</p> <pre><code> &lt;?php class Users_Model extends CI_Model{ function validate(){ $this-&gt;db-&gt;where('username',$this-&gt;input-&gt;post('username')); $this-&gt;db-&gt;where('password',md5($this-&gt;input-&gt;post('password'))); $query = $this-&gt;db-&gt;get('Users'); if($query-&gt;num_rows == 1){ $row = $query-&gt;row(); return $row; } } function roles($id){ $this-&gt;db-&gt;where('id',$id); $query = $this-&gt;db-&gt;get('Groups'); if($query-&gt;num_rows == 1){ $row = $query-&gt;row(); return $row-&gt;name; } } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload