sdeering / easy-jquery-php-captcha

Easy jQuery PHP Captcha
25 stars 23 forks source link

checkCaptcha.php console Warning #1

Closed totallytotallyamazing closed 10 years ago

totallytotallyamazing commented 10 years ago

Hi Sam, I am trying to implement your easy-jquery-php-captcha and keep getting this console error in Firefox Firebug while locally testing it. This warning/error is stopping everything including the dummyScript.php from writing its success message. Can you please help! Thanks, Derek My Console Warning/error:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /Library/WebServer/Documents/Derek/totallytotallyamazing/easy-jquery-php-captcha-master/php/checkCaptcha.php:1) in /Library/WebServer/Documents/Derek/totallytotallyamazing/easy-jquery-php-captcha-master/php/checkCaptcha.php on line 2
true

sdeering commented 10 years ago

Hi Derek, You need to use Session Buffer to control the output buffering of the headers. See here for more info: http://www.php.net/manual/en/function.ob-start.php Sam

totallytotallyamazing commented 10 years ago

Ok Sam, I tried this to my checkCaptcha.php file:

<?php
session_start();
bool ob_start ([ callable $output_callback = NULL [, int $chunk_size = 0 [, int $flags = PHP_OUTPUT_HANDLER_STDFLAGS ]]] )
if(isset($_REQUEST['code']))
{
    echo json_encode(strtolower($_REQUEST['code']) == strtolower($_SESSION['captcha']));
}
else
{
    echo 0; // no code
}
?>

And now I'm getting this Warning/error:
Parse error: parse error in /Library/WebServer/Documents/Derek/totallytotallyamazing/easy-jquery-php-captcha-master/php/checkCaptcha.php on line 3

Can you please offer me a quick fix to my code? Thank you again, Derek

totallytotallyamazing commented 10 years ago

I removed all of the spaces / tabs between "session_start();" and "if(isset($_REQUEST['code']))" and that fixed the problem. Here is my code in checkCaptcha.php:

<?php
session_start();
if(isset($_REQUEST['code']))
{
echo json_encode(strtolower($_REQUEST['code']) == strtolower($_SESSION['captcha']));
}
else
{
echo 0; // no code
}
?>
totallytotallyamazing commented 10 years ago

Hi Sam, Thank you very much for this awesome Captcha, much appreciation! I did manage to get it up and running live on my site. http://www.totallytotallyamazing.com/ Best, Derek

sdeering commented 10 years ago

That's great good work Derek! :)

On Friday, 4 April 2014, Derek Nash notifications@github.com wrote:

Hi Sam, Thank you very much for this awesome Captcha, much appreciation! I did manage to get it up and running live on my site. http://www.totallytotallyamazing.com/ Best, Derek

— Reply to this email directly or view it on GitHubhttps://github.com/sdeering/easy-jquery-php-captcha/issues/1#issuecomment-39493331 .

Cheers, Sam

totallytotallyamazing commented 10 years ago

Hi Sam, Thanks for the compliment by the way... but I am curious and have a generic question about your captcha since I noticed It does not seem to function in ie 9. Do you know if it functions in ie 10 or ie 11? And do you care if it functions in ie 9 or not because I'm not sure if I do... Ha-ha!

On Thu, Apr 3, 2014 at 7:59 PM, Sam Deering notifications@github.comwrote:

That's great good work Derek! :)

On Friday, 4 April 2014, Derek Nash notifications@github.com wrote:

Hi Sam, Thank you very much for this awesome Captcha, much appreciation! I did manage to get it up and running live on my site. http://www.totallytotallyamazing.com/ Best, Derek

— Reply to this email directly or view it on GitHub< https://github.com/sdeering/easy-jquery-php-captcha/issues/1#issuecomment-39493331>

.

Cheers, Sam

— Reply to this email directly or view it on GitHubhttps://github.com/sdeering/easy-jquery-php-captcha/issues/1#issuecomment-39519353 .

Derek Nash c (646) 265-3773 totallytotallyamazing.com