warning error came..
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\hshome\blackray\demo.blackraycreatives.com\gym\testing\final\employees.php:1) in D:\hshome\blackray\demo.blackraycreatives.com\gym\testing\final\captcha.class.php on line 21
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\hshome\blackray\demo.blackraycreatives.com\gym\testing\final\employees.php:1) in D:\hshome\blackray\demo.blackraycreatives.com\gym\testing\final\captcha.class.php on line 21
i have catcha.class.php include
captcha.class.php
class Capthcacode {
function imagedisplay($rand) {
$font = 'MAKEM___.ttf';
$im = @imagecreate(80, 25) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagettftext($im, 16, 0, 10, 20, $text_color, $font, $rand);
$path = "captcha/captcha.png";
imagepng($im, $path, 9);
imagedestroy($im);
echo $path;
}
function initialize() {
ob_start();
session_start();
if(!isset($_SESSION['captcha'])) {
$rand = rand(10,254677);
$_SESSION['captcha'] = $rand;
session_register();
}
}
}
$captcha = new Capthcacode;
employees.php
<?php
include("captcha.class.php");
$captcha->initialize();
ob_start();
if(isset($_REQUEST['submit'])) {
if( $_SESSION['captcha'] == $_POST['captchacode'] && !empty($_SESSION['captcha'] ) ) {
echo 'Thank you.';
} else {
header("location:employees.php");
}
unset($_SESSION['captcha']);
}
?>
<form method="post" action="employee.php" name="emp" onsubmit="return validate_form(this)" >
<div class="textboxouter1">
<div class="reumerinner">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr >
<td width="33%" height="36" class="fontasall brdclr">Name :</td>
<td width="55%" class="pl8"><input type="text" id="status" name="txtnamefit" /></td>
<td width="12%"> </td>
</tr>
<tr>
<td height="36" class="fontasall brdclr">Name of Contact Person : </td>
<td style="height: 28px" class="pl8"><input type="text" id="status" name="txtcontact" /></td>
<td style="height: 28px"> </td>
</tr>
<tr>
<td height="36" class="fontasall brdclr">Address and Location :</td>
<td style="height: 32px" class="pl8">
<input type="text" id="status" name="txtadd" /></td>
<td style="height: 32px"> </td>
</tr>
<tr>
<td height="36" class="fontasall brdclr">Phone No :</td>
<td style="height: 32px" class="pl8">
<input type="text" id="status" name="txtphone" /></td>
<td style="height: 32px"> </td>
</tr>
<tr>
<td height="36" class="fontasall brdclr">Email id :</td>
<td class="pl8">
<input type="text" id="status" name="email" /></td>
<td> </td>
</tr>
<tr>
<td height="36" class="fontasall brdclr">Looking for :</td>
<td style="height: 32px" class="pl8">
<textarea name="txtlookfor" cols="" rows="" onfocus="this.style.background = 'url(images/2.gif)';" onblur="this.style.background='url(images/1.gif)';" class="textarea1" ></textarea></td>
<td style="height: 32px"> </td>
</tr>
<tr>
<td height="36" class="fontasall brdclr">Other Info :</td>
<td class="pl8">
<input type="text" id="status" name="txtother" /></td>
<td> </td>
</tr>
<tr>
<td height="43" class="fontasall brdclr">Word Verifications :</td>
<td class="pl8">
<input type="text" name="captchacode" id="captchacode" />
<img src="<?php $captcha->imagedisplay("$_SESSION[captcha]");?>" alt="captcha" /></td>
<td> </td>
</tr>
<tr>
</table>
the text box enter the value and captcha image not same ,, but execute the page.