Xpression News - A PHP based script that allows you to post news and integrate it into your website. Stores the data using a flat file system instead of using a database system like MySQL.
reCAPTCHA - A system developed at Carnegie Mellon University that uses CAPTCHA to help digitize the text of books while protecting websites from bots attempting to access restricted areas.
Why use reCAPTCHA when Xpression News has one built in?
1. If your website host doesn't support the GD Graphics Library (e.g. T35.com), the built in CAPTCHA system.
2. reCAPTCHA has support for audio for the visually impaired.
3. reCAPTCHA uses this system to identify words that are hard to be interpreted by computers (OCR).
To get a feeling on how it would look like after reCAPTCHA is integrated into Xpression News, visit my friend's site, Kit's Anime MIDIs, for a test drive. (No relation to me since both of us have the same nickname.)
How to integrate reCAPTCHA and Xpression News 2.0?
A. Get the reCAPTCHA library and keys
1. Register for an account at http://www.recaptcha.net .
2. Once registration is completed, log in and select Add New Site.
3. Enter your domain. (E.g. kit50.t35.com)
4. Once that's done, take note of the private and public keys.
B. Integration with Xpression News 2.0
1. Get the latest reCAPTCHA library. Found here at Google Code.
2. Extract the archive and copy recaptchalib.php to the root of your Xpression News installation. (E.g. If you installed it at http://example.com/xpression-news/, put it inside the "xpression-news" folder.)
3. Using your favourite text editor (e.g. Notepad, Notepad++, SciTE, Kate), edit the following files:
functions.php
Original (starting at line 2723):
function VerifyCaptcha()
{
require("config.inc.php");
if ($script['comments']['captcha']=="ON")
{
@session_start();
$entered=$_POST['confirmation'];
$valid=$_SESSION['xnewscaptchacode'];
if ($valid==$entered){return true;}else{return false;}
}else {return true;}
}
Modified (starting at line 2723):
function VerifyCaptcha()
{
require("config.inc.php");
if ($script['comments']['captcha']=="ON")
{
@session_start();
$entered=$_POST['confirmation'];
$valid=$_SESSION['xnewscaptchacode'];
require_once('recaptchalib.php');
$xmod_privatekey = "...";
$resp = recaptcha_check_answer ($xmod_privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
// if ($valid==$entered){return true;}else{return false;}
if ($resp->is_valid){return true;}else{return false;}
}else {return true;}
}
skin.php
Original (starting at line 312):
$addform=str_replace('{CAPTCHAIMAGE}','<img src="'.$script['paths']['url'].'captcha.php">',$addform);
Modified (starting at line 312):
//$addform=str_replace('{CAPTCHAIMAGE}','<img src="'.$script['paths']['url'].'captcha.php">',$addform);
require_once('recaptchalib.php');
$xmod_publickey = "...";
$xmod_recaptchahtml = recaptcha_get_html($xmod_publickey);
$addform=str_replace('{CAPTCHAIMAGE}',$xmod_recaptchahtml,$addform);
4. Again using your favourite text editor, go to the templates folder and open the folder of the current template (e.g. If you are using the template called Lite, enter the Lite folder) and modify the following file:
addcomment.html
In the file, find the following code that starts with "<input name="confirmation" As an example I will use the Lite template to showcase how it would look like.
<input name="confirmation" type="text" id="confirmation" tabindex="2" size="27" style="color: #FFFFFF; border: 1px solid #000000; background-color: #51688C">
Comment the line using
<!-- ... -->
Example:
<!-- <input name="confirmation" type="text" id="confirmation" tabindex="2" size="27" style="color: #FFFFFF; border: 1px solid #000000; background-color: #51688C"> -->
What you have done just now is to remove the original CAPTCHA system that was used by the script.
5. At this stage, it is currently working but the following text is still there: "If you can't read this code, refresh this page". To remove it, go to the language folder and into English folder. (This also applies to other languages as well)
Look for this line: $lng['l_captchahelp1']='If you can\'t read this code, refresh this page';
Modify as the following:
//$lng['l_captchahelp1']='If you can\'t read this code, refresh this page';
$lng['l_captchahelp1']='';
Some of the codes I have shown there are // . In PHP, these are comments. The reason why I have commented out these codes is that in case you want to revert back to its original form, you can undo the changes accordingly.
For more information on the reCAPTCHA API:
http://recaptcha.net/plugins/php/
Any comments on how to improve the implementation, please post them here.
Instructions revision
Version 1.01 - Minor spelling adjustments.
Version 1.0 - Initial
