Witam.
W miejscu, w którym mam komentarze pojawia się błąd:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/lokotheb/domains/........menu.php:20) in /home/lokotheb/domains/............komentator.php on line 3
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/lokotheb/............menu.php:20) in /home/lokotheb/domains/.....................komentator.php on line 3
Dodatkowo nie pojawia się kod captcha - brak literek, tło jest.
capcha.php
<?php
/* config */
$imgPatch = "images-captcha/";
$fntPatch = "fonts/";
$images = preg_grep("/.+\..+/si", scandir
($imgPatch));
$fonts = preg_grep("/.+\..+/si", scandir
($fntPatch));
/* script */
$i = imagecreatefromjpeg($imgPatch . $images);
imagettftext
($i, 25
, rand(-7
, 7
), rand(1
, 20
), ceil(next(getimagesize($imgPatch . $images))/2
)+10
, imagecolorallocatealpha
($i, 255
, 255
, 255
, 60
), $fonts, $_SESSION["captcha"]);
header('Content-Type: image/jpeg'); imagejpeg($i);
imagedestroy($i);
?>
komentator.php
<?php
$status = "";
if ( isset ( $_POST["submit"] ) ) {
{
$status = "info";
}
else
{
$status = "error";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
<title>Test formularza zabezpieczonego captcha</title>
<meta name="author" content="JG24 TEAM - Marusz" />
<meta name="copyright" content="2009" />
<style type="text/css">
* { font-family: Arial, Verdana; font-size: 12px; }
input, textarea { display: block; padding: 3px; margin: 2px 0; border: 1px solid grey; }
form { padding: 15px; }
div#error { border: 2px solid #000; background-color: #ff0000; color: #fff; font-weight: bold; padding: 10px; }
div#info { border: 2px solid orange; background-color: yellow; color: #000; font-weight: bold; padding: 10px; }
</style>
</head>
<body>
<?php
if ( !empty ( $status ) ) {
?><div id="
<?php echo $status; ?>">
<?php echo $status == "info" ?
"Formularz został wysłany poprawnie" : "Wyst?pił bł?d - formularz nie zostanie wysłany..." ?></div>
<?php
}
?>
<form method="post">
Imię:
<input type="text" name="imie" value="
<?php if ( isset ( $_POST["imie"] ) && $status != "info" ) { echo htmlspecialchars($_POST["imie"]); } ?>" />
Tekst:
<br />
<textarea name="tekst">
<?php if ( isset ( $_POST["tekst"] ) && $status != "info" ) { echo htmlspecialchars($_POST["tekst"]); } ?></textarea>
<hr />
<img src="captcha.php" alt="captcha" />
<br />
Przepisz tekst z powyższego obrazka:
<input type="text" name="captcha" value="" />
<hr />
<input type="submit" name="submit" value="Wy?lij formularz" />
</form>
</body>
</html>
Skąd ten błąd?
Z góry dziękuję i pozdrawiam,
Ten post edytował lokotheboy 23.02.2012, 22:17:10