Want to take part in these discussions? Sign in if you have an account, or apply for one below
Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.
<?php
$lang['plugin']['securimage'] = array(
'prefix' => 'As a way to prevent abuses of this commenting system, '.
'we must ask you to reproduce the text on the image above, please: ',
'reload' => 'Reload image',
'speaker' => 'Audible version of CAPTCHA-image',
'error' => 'Result was incorrect, please retry.'
);
?>
<?php
include 'defaults.php';
include INCLUDES_DIR .'includes.php';
// system setup: loads plugins, setups session, cookies etc.
system_init();
// call the action hook 'fp-service'
do_action('fp-service');
?>
5. Add session_start(); on the very first line of the flatpress files index.php and comments.php in the main installation directory.
Posted By: marcoverga86Well, if you tried it and it works, you can also add it to thewiki!!! :)
Posted By: NoWhereManthis shouldn't be needed.
Doesn't work else :/
<?php
include 'securimage.php';
include '../../defaults.php';
include INCLUDES_DIR .'includes.php';
$fp_config = config_load();
cookie_setup();
sess_setup();
$img = new securimage();
$img->show(); // alternate use: $img->show('/path/to/background.jpg');Posted By: NoWhereMan
FP session name is set to a particular value, the captcha in securimage_show.php uses the default name, therefore it can't read the correct value.
theorethically, this should be the right way to do it
Posted By: NoWhereMan<?php
include 'securimage.php';
include '../../defaults.php';
include INCLUDES_DIR .'includes.php';
Perhaps the securimage code is as easy to change the session name in? Any thoughts?
Read the securimage installation hints
They suggests the approach I did it :)
<img src="BLAH-BLAH/fp-plugins/securimage/securimage_show.php?sid=etcetc" etc etc /> tag. What file were you thinking of there?
It looks like having a FP-core file call securimage.php should work as there is a code piece in securimage.php not starting a session if there is one?
Posted By: NoWhereManPS: sorry if I might sound a bit harsh here :p
Does the throwing of a premature (from FP view) session (as above) hurt a lot while this kink is worked out?
(Is there any naming conventions for things like this?)
<?php
include 'defaults.php';
include INCLUDES_DIR .'includes.php';
// system setup: loads plugins, setups session, cookies etc.
system_init();
// call the action hook 'fp-service'
do_action('fp-service');
// register an action (a function) called plugin_securimage_service to the fp-service hook
add_action('fp-service', 'plugin_securimage_service');
function plugin_securimage_service() {
include_once("securimage.php");
global $fp_params;
// check whether URL params contain 'securimage', else skip
if (!isset($fp_params['securimage'])) return;
// if securimage == 'show' outputs the gif, if equals 'play' outputs the wav and quit.
// Otherwise just skips.
switch ($fp_params['securimage']) {
case 'show' :
$img = new securimage();
$img->show();
exit();
case 'play' :
$img = new Securimage();
header('Content-type: audio/x-wav');
header('Content-Disposition: attachment; name="securimage.wav"');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Expires: Sun, 1 Jan 2000 12:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT');
echo $img->getAudibleCode();
exit();
}
}
function plugin_securimage_comment_form() {
// load plugin strings
// they're located under plugin.PLUGINNAME/lang/LANGID/
$lang = lang_load('plugin:securimage');
$langstrings =& $lang['plugin']['securimage'];
// echoes the question and the form part
echo '<p><img src="'.BLOG_BASEURL.'service.php?x=securimage:show;sid:'.md5(uniqid(time())).'" id="captcha" alt="CAPTCHA image" />';
echo '<a style="border-bottom: none;" href="#" onclick="document.getElementById(\'captcha\').src = \''.BLOG_BASEURL.'service.php?x=securimage:show;sid:\' + Math.random(); return false"><img src="'.plugin_geturl('securimage').'reload.png" alt="'. $lang['plugin']['securimage']['reload'] . '" title="'. $lang['plugin']['securimage']['reload'] . '" border="0" style="vertical-align: top;" /></a>';
echo '<a style="border-bottom: none;" href="'.BLOG_BASEURL.'service.php?x=securimage:play"><img src="'.plugin_geturl('securimage').'speaker.png" alt="'. $lang['plugin']['securimage']['speaker'] . '" title="'. $lang['plugin']['securimage']['speaker'] . '" border="0" style="vertical-align: top;" /></a>';
echo '<br />';
echo '<label class="textlabel" for="securimagecode">'. $lang['plugin']['securimage']['prefix'] . '</label>';
echo '<br /><input type="text" name="captcha_code" id="securimagecode" maxlength="5"/><br />';
echo '</p>';
}Posted By: NoWhereManPS: just tested, works like a charm
Posted By: macmathanI wanted a captcha (those images you have to get a headache from and enter into a form manually) for my FP-sites as a better local replacement for the Accessible Antispam plugin.
<?php
/*
Plugin Name: securimage
Plugin URI: http://www.flatpress.org/forums/comments.php?DiscussionID=428/
Description: phpcaptcha with flatpress.
Author: David MacMathan & NoWhereMan (thanks!)
Version: 1.1
Author URI: http://www.flatpress.org/
*/
//*** ONE CONFIGURATION NEEDED:
//*** SET MAXLENGTH FOR THE FORM INPUT FIELD ACCORDING
//*** TO THE SELECTION DONE IN SECURIMAGE.PHP!
// register an action (a function) called plugin_securimage_service to the fp-service hook
add_action('fp-service', 'plugin_securimage_service');
// register securimage actions
add_action('comment_validate', 'plugin_securimage_validate', 5, 2);
add_action('comment_form', 'plugin_securimage_comment_form');
function plugin_securimage_service() {
include_once("securimage.php");
global $fp_params;
// check whether URL params contain 'securimage', else skip
if (!isset($fp_params['securimage'])) return;
// if securimage == 'show' outputs the gif, if equals 'play' outputs the wav and quit.
// Otherwise just skips.
switch ($fp_params['securimage']) {
case 'show' :
$img = new securimage();
$img->show();
exit();
case 'play' :
$img = new Securimage();
header('Content-type: audio/x-wav');
header('Content-Disposition: attachment; name="securimage.wav"');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Expires: Sun, 1 Jan 2000 12:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT');
echo $img->getAudibleCode();
exit();
}
}
function plugin_securimage_validate($bool, $arr) {
// if boolean $bool==false
// the test is forced to fail
if (!$bool)
return false;
// if user is loggedin we ignore the plugin
if (user_loggedin())
return true;
// call class for check
include_once("securimage.php");
$img = new Securimage();
if ($img->check($_POST['captcha_code']) == false) {
global $smarty;
$lang = lang_load('plugin:securimage');
$smarty->append('error', $lang['plugin']['securimage']['error']);
$ret = false;
}
else {$ret = true;}
return $ret;
}
function plugin_securimage_comment_form() {
// load plugin strings
// they're located under plugin.PLUGINNAME/lang/LANGID/
$lang = lang_load('plugin:securimage');
$langstrings =& $lang['plugin']['securimage'];
// echoes the question and the form part
echo '<p><img src="'.BLOG_BASEURL.'service.php?x=securimage:show;sid:'.md5(uniqid(time())).'" id="captcha" alt="CAPTCHA image" />';
echo '<a style="border-bottom: none;" href="#" onclick="document.getElementById(\'captcha\').src = \''.BLOG_BASEURL.'service.php?x=securimage:show;sid:\' + Math.random(); return false"><img src="'.plugin_geturl('securimage').'reload.png" alt="'. $lang['plugin']['securimage']['reload'] . '" title="'. $lang['plugin']['securimage']['reload'] . '" border="0" style="vertical-align: top;" /></a>';
echo '<a style="border-bottom: none;" href="'.BLOG_BASEURL.'service.php?x=securimage:play"><img src="'.plugin_geturl('securimage').'speaker.png" alt="'. $lang['plugin']['securimage']['speaker'] . '" title="'. $lang['plugin']['securimage']['speaker'] . '" border="0" style="vertical-align: top;" /></a>';
echo '<br />';
echo '<label class="textlabel" for="securimagecode">'. $lang['plugin']['securimage']['prefix'] . '</label>';
echo '<br /><input type="text" name="captcha_code" id="securimagecode" maxlength="5"/><br />';
echo '</p>';
}
Posted By: matCan you create one archive containing complete plugin (working version :-) and post it somewhere? Thanks a lot...
$this->ttf_file = dirname(__FILE__) . "/CornFed.ttf";
Posted By: mat
$this->ttf_file = dirname(__FILE__) . "/CornFed.ttf";
3. configure securimage.php (explained inside the file). Put the path to the font file as an absolute path. (In other words, specify it from the root like /home/myaccount/www/fp-plugins/securimage/font.ttf)
// echoes the question and the form part
echo '<p><img src="'.BLOG_BASEURL.'service.php?x=securimage:show;sid:'.md5(uniqid(time())).'" id="captcha" alt="CAPTCHA image" />';
echo '<a style="border-bottom: none;" href="#" onclick="document.getElementById(\'captcha\').src = \''.BLOG_BASEURL.'service.php?x=securimage:show;sid:\' + Math.random(); return false"><img src="'.plugin_geturl('securimage').'reload.png" alt="'. $lang['plugin']['securimage']['reload'] . '" title="'. $lang['plugin']['securimage']['reload'] . '" style="border: none; vertical-align: top;" /></a>';
echo '<a style="border-bottom: none;" href="'.BLOG_BASEURL.'service.php?x=securimage:play"><img src="'.plugin_geturl('securimage').'speaker.png" alt="'. $lang['plugin']['securimage']['speaker'] . '" title="'. $lang['plugin']['securimage']['speaker'] . '" style="border: none; vertical-align: top;" /></a>';
echo '<br />';
echo '<label class="textlabel" for="securimagecode">'. $lang['plugin']['securimage']['prefix'] . '</label>';
echo '<br /><input type="text" name="captcha_code" id="securimagecode" maxlength="5"/><br />';
echo '</p>';
1 to 23 of 23