-5

Warning: Cannot modify header information - headers already sent by (output started at E:\xampp\htdocs\kntl\panel\pages\um\um412_func_inc_v.03_add2.php:633) in E:\xampp\htdocs\kntl\panel\pages\ceklogin.php on line 33

Warning: Cannot modify header information - headers already sent by (output started at E:\xampp\htdocs\kntl\panel\pages\um\um412_func_inc_v.03_add2.php:633) in E:\xampp\htdocs\kntl\panel\pages\ceklogin.php on line 34

Warning: Cannot modify header information - headers already sent by (output started at E:\xampp\htdocs\kntl\panel\pages\um\um412_func_inc_v.03_add2.php:633) in E:\xampp\htdocs\kntl\panel\pages\ceklogin.php on line 35

Notice: Undefined index: ubkuser in E:\xampp\htdocs\kntl\panel\pages\ceklogin.php on line 36

Notice: Undefined index: ubklogin in E:\xampp\htdocs\kntl\panel\pages\ceklogin.php on line 37

Notice: Undefined index: ubktahun in E:\xampp\htdocs\kntl\panel\pages\ceklogin.php on line 38 SMK NEGERI 25 Warning: Cannot modify header information - headers already sent by (output started at E:\xampp\htdocs\kntl\panel\pages\um\um412_func_inc_v.03_add2.php:633) in E:\xampp\htdocs\kntl\panel\pages\ceklogin.php on line 49

the code

<?php
if(isset($_POST['userz'], $_POST['passz'])) {
        include "../../config/server.php";


        require("../../config/fungsi_thn.php");     


    $libpath1="up/";
    $js_path="um/";
    $um_path="um/";
    $docroot="";
    $toroot="";


    include_once $um_path."um412_func_inc_v.03.php";
    include_once $um_path."um412_func_inc_v.03_add2.php";   
        $userz = mysql_real_escape_string($_REQUEST['userz']);
        $passz = mysql_real_escape_string($_REQUEST['passz']);
        $passz = md5($passz);
        $loginz = mysql_real_escape_string($_REQUEST['login']);
        if($loginz == "admin"){$peran = "1";} else {$peran="0";}
        $sq="select * from cbt_user where Username = '$userz' and Password = '$passz' and login = '$peran'";
        echo $sq;
        $hs=mysql_query($sq);
        $sqladmin = mysql_num_rows($hs);
     //exit;
        if($sqladmin>0){
                    //if(!isset($_COOKIE['ubkuser'], $_COOKIE['ubklogin'])){
        $sqltahun = mysql_query("select * from cbt_setid where XStatus = '1'");
        $st = mysql_fetch_array($sqltahun);
        $tahunz = $st['XKodeAY'];
                        setcookie('ubkuser',$userz);
                        setcookie('ubklogin',$loginz);
                        setcookie('ubktahun',$tahunz);
                        $_COOKIE['ubkuser']==$userz;
                        $_COOKIE['ubklogin']==$loginz;
                        $_COOKIE['ubktahun']==$tahunz;      

                        //setting namauser
                        $namasek=carifield("select xsekolah from cbt_admin");
                        extractRecord($sq);
                        echo $Nama;
                        //exit;
                        if ($namasek!=$Nama) {
                            mysql_query("update cbt_admin set xsekolah='$Nama'");
                            //exit;
                        }
                        header("Location: ../pages/?");
                    //}


        } else { header("Location: login.php"); }
} else {

    header("Location: login.php");

}

?>
Bourbia Brahim
  • 14,459
  • 4
  • 39
  • 52
Aji Reza
  • 1
  • 1
  • 2

1 Answers1

0

header("Location: login.php"); is called after you send content (maybe an error in your includes), you should put this one before any showed contents.

I see you do that : echo $Nama; It's the kind of thing that makes a headers already sent by error...

pirs
  • 2,410
  • 2
  • 18
  • 25
  • how? and where can i put header("Location: login.php");? – Aji Reza Jun 04 '17 at 10:07
  • first, check the code before without redirect anything (put header(...) in comments with //), if that showed something like an error, or any content, that means its not good. – pirs Jun 04 '17 at 10:09