svn: /pear/packages/Bugtracker/trunk/www/ bug-pwd-finder.php bug.php patch-add.php report.php

From: Date: Fri, 05 Mar 2010 21:45:49 +0000
Subject: svn: /pear/packages/Bugtracker/trunk/www/ bug-pwd-finder.php bug.php patch-add.php report.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-cvs+get-59001@lists.php.net to get a copy of this message
philip Fri, 05 Mar 2010 21:45:49 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=295865 Log: Fixed captcha logic to fail without sessions; logged in users need not apply Changed paths: U pear/packages/Bugtracker/trunk/www/bug-pwd-finder.php U pear/packages/Bugtracker/trunk/www/bug.php U pear/packages/Bugtracker/trunk/www/patch-add.php U pear/packages/Bugtracker/trunk/www/report.php Modified: pear/packages/Bugtracker/trunk/www/bug-pwd-finder.php =================================================================== --- pear/packages/Bugtracker/trunk/www/bug-pwd-finder.php 2010-03-05 21:35:08 UTC (rev 295864) +++ pear/packages/Bugtracker/trunk/www/bug-pwd-finder.php 2010-03-05 21:45:49 UTC (rev 295865) @@ -19,10 +19,8 @@ if (isset($_POST['captcha']) && $bug_id != '') { // Check if session answer is set, then compare it with the post captcha value. // If it's not the same, then it's an incorrect password. - if (isset($_SESSION['answer']) && strlen(trim($_SESSION['answer'])) > 0) { - if ($_POST['captcha'] != $_SESSION['answer']) { - $errors[] = 'Incorrect Captcha'; - } + if (empty($_SESSION['answer']) || $_POST['captcha'] != $_SESSION['answer']) { + $errors[] = 'Incorrect Captcha'; } else { exit; } Modified: pear/packages/Bugtracker/trunk/www/bug.php =================================================================== --- pear/packages/Bugtracker/trunk/www/bug.php 2010-03-05 21:35:08 UTC (rev 295864) +++ pear/packages/Bugtracker/trunk/www/bug.php 2010-03-05 21:45:49 UTC (rev 295865) @@ -59,8 +59,8 @@ // Check if session answer is set, then compare it with the post captcha value. // If it's not the same, then it's an incorrect password. - if (isset($_SESSION['answer']) && strlen(trim($_SESSION['answer'])) > 0) { - if ($_POST['captcha'] != $_SESSION['answer']) { + if (!$logged_in) { + if (empty($_SESSION['answer']) || $_POST['captcha'] != $_SESSION['answer']) { $errors[] = 'Incorrect Captcha'; } } @@ -110,9 +110,7 @@ } // captcha is not necessary if the user is logged in -if ($logged_in) { - unset($_SESSION['answer']); -} else { +if (!$logged_in) { require_once 'Text/CAPTCHA/Numeral.php'; $numeralCaptcha = new Text_CAPTCHA_Numeral(); } Modified: pear/packages/Bugtracker/trunk/www/patch-add.php =================================================================== --- pear/packages/Bugtracker/trunk/www/patch-add.php 2010-03-05 21:35:08 UTC (rev 295864) +++ pear/packages/Bugtracker/trunk/www/patch-add.php 2010-03-05 21:45:49 UTC (rev 295865) @@ -33,9 +33,7 @@ bugs_authenticate($user, $pw, $logged_in, $is_trusted_developer); // captcha is not necessary if the user is logged in -if ($logged_in) { - unset($_SESSION['answer']); -} else { +if (!$logged_in) { require_once 'Text/CAPTCHA/Numeral.php'; $numeralCaptcha = new Text_CAPTCHA_Numeral(); } @@ -74,10 +72,8 @@ * it with the post captcha value. If it's not * the same, then it's an incorrect password. */ - if (isset($_SESSION['answer']) && strlen(trim($_SESSION['answer'])) > 0) { - if ($_POST['captcha'] != $_SESSION['answer']) { - $errors[] = 'Incorrect Captcha'; - } + if (empty($_SESSION['answer']) || $_POST['captcha'] != $_SESSION['answer']) { + $errors[] = 'Incorrect Captcha'; } if (count($errors)) { Modified: pear/packages/Bugtracker/trunk/www/report.php =================================================================== --- pear/packages/Bugtracker/trunk/www/report.php 2010-03-05 21:35:08 UTC (rev 295864) +++ pear/packages/Bugtracker/trunk/www/report.php 2010-03-05 21:45:49 UTC (rev 295865) @@ -15,9 +15,7 @@ bugs_authenticate($user, $pw, $logged_in, $is_trusted_developer); // captcha is not necessary if the user is logged in -if ($logged_in) { - unset($_SESSION['answer']); -} else { +if (!$logged_in) { require_once 'Text/CAPTCHA/Numeral.php'; $numeralCaptcha = new Text_CAPTCHA_Numeral(); } @@ -29,8 +27,8 @@ // Check if session answer is set, then compare it with the post captcha value. // If it's not the same, then it's an incorrect password. - if (isset($_SESSION['answer']) && strlen(trim($_SESSION['answer'])) > 0) { - if ($_POST['captcha'] != $_SESSION['answer']) { + if (!$logged_in) { + if (empty($_SESSION['answer']) || $_POST['captcha'] != $_SESSION['answer']) { $errors[] = 'Incorrect Captcha'; } }

« previous php.pear.cvs (#59001) next »