<? session_start(); if (isset($_SESSION['id'])){ header("Location:http://sait.ru/id".$_SESSION['id']); } else { 

print <<< END

Here is the HTML page code

END;

 } ?> 

Mistake

Warning : Cannot modify header information - (output started at /home/live-inves/live-invest.ru/docs/index.php:1) in /home/live-inves/live-invest.ru/ docs / index.php on line 4

AND

Warning : session_start () [ function.session-start ]: Cannot send session cache limiter - headers already sent (output started at /home/sait/sait.ru/docs/index.php:1) in / home / sait / sait .ru / docs / index.php on line 2

    2 answers 2

    session_start and header must be called before any output (echo, print etc). If this is your real beginning of the file, check the encoding should be "utf-8 without BOM". If in doubt, open the file in the hex editor before <? will be 2 bytes.

    • Who told you that ??? - AseN
    • But it worked the same way)) - JustK
    • one
      Brain and documentation > Note:> To use cookie-based sessions, session_start () must be called. - Sh4dow

    First, you need to learn English, because after reading the error information, you would understand everything right away. For sessions, just remove session_start (). Sessions on your server start automatically ...

    • Autostart sessions are a rarity, unless you set it up yourself. - Sh4dow