diff --git a/captcha_img.php b/captcha_img.php new file mode 100644 --- /dev/null +++ b/captcha_img.php @@ -0,0 +1,28 @@ +. + */ + +require_once('inc/class.page.php'); + +if (!$use_captcha) + page::show_404('Captchas are disabled.'); + +require('securimage/securimage.php'); +$securimage = new Securimage(); +echo $securimage->show(); diff --git a/feedback-submit.php b/feedback-submit.php --- a/feedback-submit.php +++ b/feedback-submit.php @@ -20,8 +20,14 @@ include_once 'inc/class.page.php'; - $feedbackpage = new page('Feedback'); - $subject = '[SlatePermutate] - Feedback'; +if ($use_captcha) + { + require_once('securimage/securimage.php'); + $securimage = new Securimage(); + } + +$feedbackpage = new page('Feedback'); +$subject = '[SlatePermutate] - Feedback'; ?>

Thanks!

@@ -54,16 +60,15 @@ if(empty($nameis) || empty($feedback) || $reject = TRUE; } -/** Try reCaptcha */ -if(isset($reCaptcha_priv) && isset($reCaptcha_pub)) { - require_once('inc/recaptchalib.php'); - $reCaptchaRes = recaptcha_check_answer($reCaptcha_priv, $_SERVER["REMOTE_ADDR"],$_POST["recaptcha_challenge_field"],$_POST["recaptcha_response_field"]); - - if(!$reCaptchaRes->is_valid) { - echo '

Please click "back" and enter a valid reCaptcha response.

'; - $reject = TRUE; +/** Check the captcha */ +if ($use_captcha) + { + if (!$securimage->check($_REQUEST['captcha_code'])) + { + echo '

Your captcha response was incorrect, please try again.

'; + $reject = TRUE; + } } -} if (!$reject) { @@ -88,7 +93,7 @@ Deployment = $fromdom mail($toaddr, $subject, $message, $from); } - echo '

Thanks for helping make SlatePermutate better. Your feedback is greatly appreciated.'; + echo '

Thanks for helping make SlatePermutate better. Your feedback is greatly appreciated.

'; echo '

We will attempt to respond via email if your feedback lends itself to a response.

'; } $feedbackpage->foot(); diff --git a/feedback.php b/feedback.php --- a/feedback.php +++ b/feedback.php @@ -18,12 +18,15 @@ * along with SlatePermutate. If not, see . */ - include_once 'inc/class.page.php'; +include_once 'inc/class.page.php'; - $feedbackpage = new page('Feedback'); - $ipi = $_SERVER['REMOTE_ADDR']; - $fromdom = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; - $httpagenti = $_SERVER['HTTP_USER_AGENT']; +$feedbackpage = new page('Feedback'); +$ipi = $_SERVER['REMOTE_ADDR']; +$fromdom = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; +$httpagenti = $_SERVER['HTTP_USER_AGENT']; + +$n = "\n"; + ?>
@@ -45,10 +48,14 @@

' . $n + . ' Captcha' . $n + . ' captcha image' . $n + . ' ' . $n + . ' ' . $n + . '' . $n; } ?> diff --git a/inc/class.page.php b/inc/class.page.php --- a/inc/class.page.php +++ b/inc/class.page.php @@ -27,8 +27,8 @@ define('SP_PACKAGE_STRING', SP_PACKAGE_N /* * Set up include() path for user-supplied libs (in case if his system - * doesn't have libs, such as recaptchalib.php). Users would store - * such libs in /libs. + * doesn't have libs, such as phpcaptcha + * (securimage/securimage.php)). Users would store such libs in /libs. * * Coding note: dirname(dirname('a/b/c')) returns 'a'. This is a * similar effect to dirname('a/b/c') . DIRECTORY_SEPARATOR . '..'. @@ -44,6 +44,7 @@ set_include_path(get_include_path() . PA $clean_urls = FALSE; $ga_trackers = array(); $feedback_emails = array('ez@ethanzonca.com, ngelderloos7@gmail.com, ohnobinki@ohnopublishing.net'); +$use_captcha = FALSE; $config_inc = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config.inc'; if (file_exists($config_inc)) { diff --git a/inc/config.inc.example b/inc/config.inc.example --- a/inc/config.inc.example +++ b/inc/config.inc.example @@ -60,13 +60,14 @@ /** * \brief - * Keys to use with reCaptcha for feedback form submissions + * Whether or not to use SecureImage phpcaptcha. * - * Set to your public and private keys obtained from https://www.google.com/recaptcha/ - * Be sure to keep your private key secret. + * Set to TRUE to use SecureImage captcha, FALSE to not use + * it. Requires PHP library available from http://phpcaptcha.org/ + * which may be placed in slate_permutate's lib/ directory or into the + * system PHP include path. */ -/* $reCaptcha_priv = ''; */ -/* $reCaptcha_pub = ''; */ +$use_captcha = FALSE; /** * \brief diff --git a/project.php b/project.php --- a/project.php +++ b/project.php @@ -37,8 +37,12 @@

Current development code can be retrieved via the Mercurial SCM at https://protofusion.org/hg/SlatePermutate

Requirements

-

To run properly, SlatePermutate requires a modern PHP environment (5.0+) that includes libcurl, and a writable cache directory for school and schedule data. SlatePermutate does not require a backend database.

SlatePermutate has optional requirements of Google Analytics tracking and reCaptcha for feedback forms; these options are set in the config.inc file.

- +

To run properly, SlatePermutate requires a modern PHP environment (5.0+) that includes libcurl, and a writable cache directory for school and schedule data. SlatePermutate does not require a backend database.

+

+ SlatePermutate has optional requirements of Google Analytics tracking + and phpcaptcha/securimage for + feedback forms; these options are set in the config.inc file. +

About

This program was created by Calvin College and Cedarville University students. SlatePermutate is written in PHP, with a valid XHTML frontend.