Mam takie coś:
<?
<table border="1" width="145" height="111" class="inside">
<tr>
<td height="15">
<h6>Logowanie</h6></td>
</tr>
<tr>
<td height="76">
<p align="center">
<FORM Action="'.$_SERVER['REQUEST_URI'].'" METHOD="POST">
<input type="text" id="lg" name="log" size="20"><br>
<input type="password" name="has" size="20"><br>
<input type="submit" value="Loguj"></td>
</form>
</tr>
</table>
';
$file = 'user.dat';
$ile_wpisow = count($dane);
if (isset($_COOKIE['loged'])) {
$loged = $_COOKIE['loged'];
if ($loged == '1')
{
<table border="1" width="145" height="111" class="inside">
<tr>
<td height="15">
<h6>Konto użytkownika</h6>
</td>
</tr>
<tr>
<td height="76">
<p align="left">
Jesteś zalogowany/wana jako '.$_COOKIE['login'].'
<form action="'.$_SERVER['REQUEST_URI'].'" method="post">
<input type="hidden" name="loginout" value="1">
<input type="submit" value="Wyloguj">
</form>
';
}
} else {
if (isset($_POST['loginout'])) {
Header('Location:'.$_SERVER['REQUEST_URI']); }
{
if ($_POST['log'] <> '')
{
$log = $_POST['log'];
if ($_POST['has'] <> '')
{
$has = $_POST['has'];
$loged=0;
for ($i = 0; $i <= $ile_wpisow - 1; $i++)
{
if ($log == $info[0])
{
if ($has == $info[1])
{
$loged=1;
Header('Location:'.$_SERVER['REQUEST_URI']); break;
} else { $error = 'pass_bad'; }
} else { $error = 'log_bad'; }
}
} else { $error = 'pass'; }
} else { $error = 'log'; }
}}
if (isset($_GET['error'])) { $error = $_GET['error'];
for ($i=0; $i<=$ile_wpisow-1; $i++) {$info = explode('|', $dane[$i]); $datas .= $info[0].'_'.$info[1].'<br>'; }}
switch($error){
case 'log':
echo '<font color="red"><b>Podaj login</font></b>'; break;
case 'pass':
echo '<font color="red"><b>Podaj hasło</font></b>'; break;
case 'log_bad':
echo '<font color="red"><b>Nieprawidłowe login</font></b>'; break;
case 'pass_bad':
echo '<font color="red"><b>Nieprawidłowe hasło</font></b>'; break;
case 'loginw':
echo '<font color="red"><b>'.$datas.'</font></b>'; break;
}
}
?>
I wyskakują takie błędy:
Warning: Cannot modify header information - headers already sent by (output started at c:\program files\easyphp1-8\www\strona\index.php:15) in c:\program files\easyphp1-8\www\strona\login.php on line 79
Warning: Cannot modify header information - headers already sent by (output started at c:\program files\easyphp1-8\www\strona\index.php:15) in c:\program files\easyphp1-8\www\strona\login.php on line 80
Warning: Cannot modify header information - headers already sent by (output started at c:\program files\easyphp1-8\www\strona\index.php:15) in c:\program files\easyphp1-8\www\strona\login.php on line 81
Są to te linie:
setcookie('loged', $loged, 0);
setcookie('login', $log, 0);
Header('Location:'.$_SERVER['REQUEST_URI']);
Co mam zrobić żeby tych błędów nie było??