Re: Captcha (Visual Confirmation) for adding comments Re: Captcha (Visual Confirmation) for adding comments
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Re: Captcha (Visual Confirmation) for adding comments

Started by nokc, August 26, 2007, 02:36:49 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nokc

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.



<?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

Sami

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
‍I don't answer to PM with support question
Please post your issue to related board