Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Re: Captcha (Visual Confirmation) for adding comments  (Read 3928 times)

0 Members and 1 Guest are viewing this topic.

nokc

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: Captcha (Visual Confirmation) for adding comments
« on: August 26, 2007, 02:36:49 pm »

I cannot get my code set up to display for non registered users.  Can you help me?

This is what it reads:

Somewhere I am missing some code or took the wrong thing out.



Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2006 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.12
  CAPTCHA Plugin 
  Based on Mod by Abbas ali(http://forum.coppermine-gallery.net/index.php?topic=29564.0)
  Plugin Writen by bmossavari at gmail dot com
**********************************************/

if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

// Add a filter for the gallery header
$thisplugin->add_filter('page_html','captcha_main');
// Add actions
$thisplugin->add_action('page_start','captcha_page_start');

// captcha function to modify gallery header html
function captcha_main($html) {
global $lang_display_comments$lang_register_php$lang_plugin_captcha_conf;
if(!USER_ID) { 
if(preg_match($exper,$html)){
if(USER_ID) {
$newcpch '<!-- CAPTCH PLUGIN --><input type="submit" class="comment_button" name="submit" id="submit" value="'.$lang_display_comments['OK'].'" /></td></tr><tr><td class="tableb_compact" colspan="2">'.$lang_plugin_captcha_conf.'</td><td class="tableb_compact" colspan="2"><input type="text" name="confirmCode" id="confirmCode" size="5" class="textinput"><img src="./plugins/captcha/captcha.php" align="middle">';
} else {
$newcpch '<!-- CAPTCH PLUGIN --><input type="submit" class="comment_button" name="submit" id="submit" value="'.$lang_display_comments['OK'].'" /></td></tr><tr><td class="tableb_compact" >'.$lang_plugin_captcha_conf.'</td><td class="tableb_compact" ><input type="text" name="confirmCode" id="confirmCode" size="5" class="textinput"><td class="tableb_compact"><img src="./plugins/captcha/captcha.php" align="middle"></td><td class="tableb_compact" >&nbsp;</td><td class="tableb_compact" >&nbsp;</td>';
}
$html preg_replace($exper,$newcpch,$html);
}
}
if(preg_match($exper,$html)){
$newcpch '<!-- CAPTCH PLUGIN --><input type="hidden" value="captcha_check" id="reg_captcha" name="reg_captcha" /><tr><td class="tableb" height="25" width="40%">'.$lang_plugin_captcha_conf.'</td><td class="tableb_compact" colspan="2"><input type="text" name="confirmCode" id="confirmCode" size="5" class="textinput"><img src="./plugins/captcha/captcha.php" align="middle"></tr><tr><td colspan="2" align="center" class="tablef">
                        <input type="submit" name="submit" value="'
.$lang_register_php['submit'].'" class="button" />
                </td></tr>'
;
$html preg_replace($exper,$newcpch,$html);
}
return $html;
}
function 
captcha_page_start()
{
global $lang_plugin_captcha_conf$CONFIG;
require ('plugins/captcha/include/init.inc.php');
require('plugins/captcha/include/captcha.class.php');
if(!USER_ID) {  {
load_template();
pageheader($lang_error);
cpg_die(ERROR"$lang_plugin_captcha_error"__FILE____LINE__);
}
}
}
?>

Edit By Sami:
added code block to php code
« Last Edit: August 27, 2007, 09:52:09 am by Sami »
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: Re: Captcha (Visual Confirmation) for adding comments
« Reply #1 on: August 27, 2007, 10:07:36 am »

I've moved your unrelated reply to captcha mod here cause it's about captcha plugin
next time please post to proper board and also put your php code under code block (by using # button when creating your post)

I don't understand your actual question ???
plugin will display captcha for unregistered users as default
so just use original codebase to accomplish this
Logged
‍I don't answer to PM with support question
Please post your issue to related board
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.