-1

I have probelm with COOKIE.

Error:

Cannot modify header information - headers already sent by (output started at /data/web/virtuals/9784/virtual/www/subdom/roids/_libs/_lib.php:1) in /data/web/virtuals/9784/virtual/www/subdom/roids/_libs/_lib.php on line 43

Index:

<?php
session_start();
error_reporting(E_ALL);
require_once('_libs/_console.php');
require_once('_libs/class.phpmailer.php');
require_once('_libs/_lib.php');
//require_once('_libs/PasswordLib.phar');

$db = new database();
$func = new functions($db);
$cms = new CMS_system($func, $db);


$func->setLang();

The file _lib.php starts with <?php and there is no whitespace at the start. That file contains classes and functions.

Function setlang:

    public function setLang() {

    setcookie("lang", "sk", time()+60*60*24*30);
    if (isset($_POST['lang'])) {
        setcookie("lang", $_POST['lang'], time()+60*60*24*30);
    }

}

I tried deleting session_start from script but that does not work. Thanks for any comments or solutions

DeiForm
  • 701
  • 9
  • 31

3 Answers3

0

Remove Echo if any at _lib.php file..and then try..

Harshit Tailor
  • 3,261
  • 6
  • 27
  • 40
0

Can you try removing closing PHP tag (i.e. ?>) from all 3 included files and then check?

Amit
  • 1,365
  • 8
  • 15
0

You cannot modify cookies after you have sent data to the client. Do the setlang call before printing content.

PurkkaKoodari
  • 6,703
  • 6
  • 37
  • 58