-3

Warning: Cannot modify header information - headers already sent by (output started at /srv/disk3/1618233/www/netdisk.co.nf/mojprofil.php:27) in /srv/disk3/1618233/www/netdisk.co.nf/classes/Redirect.php on line 18

so thats the error i tryed alot of stuff but i m out of ideas to fix that as soon as the

mojprofil.php:

<?php
session_start();
require_once 'core/init.php';
?>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Domov</title>
        <link rel="stylesheet" type="text/css" href="Styles/Stylesheet.css" /> 
    </head>
    <body>
        <div id="wrapper"> 
            <div id="banner">   
            </div>

            <nav id="navigation">
                <ul id="nav">
                    <li><a href="index.php">Domov</a></li>
                    <li><a href="mojprofil.php">Moj profil</a></li>
                    <li><a href="#">Pomoč</a></li>
                    <li><a href="kontakt.php">Kontakt</a></li>
                </ul>
            </nav>

            <div id="content_area">
                <?php
                require_once 'core/init.php';
                if(Session::exists('home')) {
                    echo '<p>' . Session::flash('home') .'</p>';

                }

                $user = new User();
                if (!$user->IsLoggedIn()) {
                    include 'login.php';
                    ob_end_flush();
                    ?>
                <p>
                    Če nimate računa pritisnite<a href="register.php">TUKAJ</a>.
                </p>
                <?php
                session_start();
                } else {

                }
                ?>
            </div>

            <div id="sidebar">
                <?php
                include 'index_2.php'; 
                ?>
            </div>

            <footer>
                <p>Vse pravice pridržane.</p>
            </footer>
        </div>     
    </body>
</html>

and the redirect.php:

<?php
session_start();
?>
<?php
class Redirect {
    public static function to($location = null) {
        if($location) {
            if(is_numeric($location)) {
                switch($location) {
                    case 404;
                        header('HTTP/1.0 404 Not Found');
                        include 'includes/errors/404.php';
                        exit();
                    break;
                }
            }
            header('Location: ' . $location);
            exit();
        }
    }
}
?>
lenart95
  • 45
  • 1
  • 7
  • 1
    Why do you have two session_start() on redirect.php? – John Conde Feb 13 '14 at 14:54
  • If any of those `include()` calls you're doing in all of that code have header calls, then there's your problem. Just because your `session_start()` is that the top of a particular script and has no "output" in that script means **NOTHING** if that script is included in a file which HAS HAD output performed. – Marc B Feb 13 '14 at 14:59

1 Answers1

-1

Add @ob_start() in top of the page.

Krish R
  • 22,583
  • 7
  • 50
  • 59