Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: [ Cookies ] Bėda

Parašė sidicer· 2010 Rugp. 18 21:08:44
#6

Error:
Warning: Cannot modify header information - headers already sent by (output started at /home/lauras/domains/sdcwap.x0.lt/public_html/index.php:21) in /home/lauras/domains/sdcwap.x0.lt/public_html/index.php on line 77


77: setcookie("loged","$datanick",$laikas);

Kodas:
<html>

<head>
<title>SiDiCeR Wap'as</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
<center>
<table>
<!-- -->
<tr>
<td class="juosta">
Sveiki atvyke i SiDiCeR WAP'a
</td>
</tr> 
<tr><td></td></tr>
<tr>
<td class="juosta2">
<br />
<?php
if (isset($_COOKIE["loged"]))
{
echo "Sveikas, " . $_COOKIE["loged"] . "!<br />";
}
else
{
echo "Sveikas, Svety!<br />";
?>
<form action="index.php" method="post">
Nickname: <input type="text" name="nick" /> <br />
Password: <input type="password" name="pass" /> <br />
<input type="submit" name="sub" />
</form>
<?php
}
?>
</td>
</tr>
<!-- -->
<tr>
<?php
// MySQL Connect
$con = mysql_connect("localhost","","") or die("Neprisijungiu prie MySQL");
mysql_select_db("") or die("Nerandu duomenu bazes");
//
if ($_POST['sub'])
{
//
echo '<td class="juosta3">';
//

$inputnick = $_POST['nick'];
$inputpass = $_POST['pass'];
$mdpass    = md5($inputpass);

$getdata = mysql_query("SELECT * FROM users");

while($rows = mysql_fetch_assoc($getdata))
{
$datanick = $rows['nick'];
$datapass = $rows['pass'];
}

if ($inputnick == "" || $inputpass == "")
{
echo "Laukeliai tusti";
}

elseif ($datanick != $inputnick || $datapass != $mdpass)
{
echo "Slapyvardis arba Slaptazodis blogi";
}
else
{   
$laikas = time()+ 60*60*24;
setcookie("loged","$datanick",$laikas);
print Prisijungei;
}

//
echo '</td>';   
//
}
?>
</td>
</tr>
<!-- -->
<tr>
<td class="juosta2">
Naujienos: <br />
Bla Bla Bla
</td>
</tr>
<!-- -->
<tr><td></td></tr>
<!-- -->
<tr>
<td class="juosta">
&copy; SiDiCeR
</td>
</tr>
<!-- -->
</table>
</center>
</body>

</html>



Redagavo sidicer· 2010 Rugp. 18 21:08:31