Hosting website codeigniter

Sore gan, jadi gue mau coba coba hosting web dengan framework codeigniter pada halaman pengunjung semua baik baik ketika login dan sudah diredirect ke error massage seperti dibawah ini, mohon bantuannya agan

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /storage/ssd4/311/11393311/public_html/application/controllers/admin/Login.php:16)

Filename: helpers/url_helper.php

Line Number: 564

Backtrace:

File: /storage/ssd4/311/11393311/public_html/application/controllers/admin/Login.php Line: 27 Function: redirect

File: /storage/ssd4/311/11393311/public_html/index.php Line: 315 Function: require_once

ini code pada login.php

<?php
class Login extends CI_Controller{
    function __construct(){
        parent:: __construct();
        $this->load->model('m_login');
    }
    function index(){
        $this->load->view('admin/v_login');
    }
    function auth(){
        $username=strip_tags(str_replace("'", "", $this->input->post('username')));
        $password=strip_tags(str_replace("'", "", $this->input->post('password')));
        $u=$username;
        $p=$password;
        $cadmin=$this->m_login->cekadmin($u,$p);
        echo json_encode($cadmin);
        if($cadmin->num_rows() > 0){
         $this->session->set_userdata('masuk',true);
         $this->session->set_userdata('user',$u);
         $xcadmin=$cadmin->row_array();
         if($xcadmin['pengguna_level']=='1'){
            $this->session->set_userdata('akses','1');
            $idadmin=$xcadmin['pengguna_id'];
            $user_nama=$xcadmin['pengguna_nama'];
            $this->session->set_userdata('idadmin',$idadmin);
            $this->session->set_userdata('nama',$user_nama);
            redirect('admin/dashboard');
         }else{
             $this->session->set_userdata('akses','2');
             $idadmin=$xcadmin['pengguna_id'];
             $user_nama=$xcadmin['pengguna_nama'];
             $this->session->set_userdata('idadmin',$idadmin);
             $this->session->set_userdata('nama',$user_nama);
             redirect('admin/dashboard');
         }

       }else{
         echo $this->session->set_flashdata('msg','<div class="alert alert-danger" role="alert"><button type="button" class="close" data-dismiss="alert"><span class="fa fa-close"></span></button> Username Atau Password Salah</div>');
         redirect('admin/login');
       }

    }

    function logout(){
        $this->session->sess_destroy();
        redirect('admin/login');
    }
}

avatar bagusss
@bagusss

6 Kontribusi 0 Poin

Diperbarui 3 tahun yang lalu

2 Jawaban:

<pre> redirect('admin/login'); redirect('admin/dashboard'); //ini controller? </pre>

avatar ameliac
@ameliac

104 Kontribusi 27 Poin

Dipost 5 tahun yang lalu

<pre>masalahnya di apa ya.. saya juga sama gak bisa login error terus</pre>

avatar arsilayubi
@arsilayubi

1 Kontribusi 0 Poin

Dipost 3 tahun yang lalu

Login untuk ikut Jawaban