Stworzyłem stronę z logowaniem opartym na sesjach. Na serwerze nazwa.pl wszystko śmigało.
Gdy kopie strony próbuję uruchomić na localchost (krasnal) to wyskakuje taki błąd:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\usr\krasnal\www\ogame\index.php:1) in c:\usr\krasnal\www\ogame\index.php on line 3
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\usr\krasnal\www\ogame\index.php:1) in c:\usr\krasnal\www\ogame\index.php on line 3
i do URL'a dodaje: PHPSESSID=aa28a0272574ab0c5a11146fb291913d
oto kod php:
index.php
[codebox]
<?php $expiryTime = 1800;// nowa sesja - ustaw czas początkowy sesji { $_SESSION['last_trace'] = $now; }// sesja wygasła elseif ((int)$_SESSION['last_trace'] + $expiryTime < $now) { { } $_SESSION["status"]= 0; $_SESSION["status"]= 0; $haslo= 0; $log = 0; } ?> <? include 'themes/theme.php'; include 'db/glowna.php'; ?> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Strona aGF</title> </head> <div id="center"> <div id="LOGO"> <img src="images/logo.jpg" style="width: 780px; height: 150px;" alt="" /> </div> <div id="NAGLOWEK"> <? echo ' <a href="index.php">Strona główna</a> '; ?> </div> <div id="MENUL"> <div id="MENUODSTEP"></div> <div id="MENUBELKA"> MENU: <hr></DIV> ► <a href="index.php">Strona główna</a><br> ► <a href="?page=artykuly">Artykuły</a><br> ► <a href="?page=psojusz&id=1">Strona <_aGF_></a><br> </div> <div id="TRESC"> <? if ($_GET['page']) {} else {$_GET['page']= 'news';}; { switch ($_GET['page']) { case "admin": include 'page.php'; break; case "artykuly": include 'db/articles.php'; break; case "psojusz": include 'db/psojusz.php'; break; Default: include 'db/news.php'; } } ?> </div> <? include 'login.php'; echo '<div id="informacje"> <div id="MENUODSTEP"></div> <div id="MENUBELKA">'.$powitanie.'</div> '.$menu.'<br>'.$logowanie.' </div>'; ?></div><center> <div style="width: 780px; background-color: #888;">Copyright by Patryk G.</div> <? ?>