Hi, I have a gallery plugin with comments, I can add to this captcha code, bude not working
Please help me, now Can't post comments Where I have error?
function AddComment($dir,$pic){
global $plugin_cf,$plugin_tx,$sn,$su,$files,$title_array;
$page = getvariable('page');
$file = $files[$pic];
$size = GetImageSize ($dir."thumb/tn_".$file);
$w=$size[0];
$h=$size[1];
$t = "<fieldset class=\"gallery_fieldset\">";
$title = $title_array[$pic][0];
$t .= "<div class=\"addcomment\">";
$t .= "<div class=\"thumbnailitem\">";
if(eregi("true",$plugin_cf['gallery']['show_title']) and eregi("top",$plugin_cf['gallery']['title_placement']))$t .= $title;
$t .=tag('br')."<a href=\"$sn?$su\" class=\"thumb\">".tag('img src="'.$dir.'thumb/tn_'.rawurlencode($file).'" height="'.$h.'" width="'.$w.'" alt="'.$title.'"')."</a>".tag('br');
if(eregi("true",$plugin_cf['gallery']['show_title']) and eregi("bottom",$plugin_cf['gallery']['title_placement']))$t .= $title;
$t .= "</div>";
$t .= "<div class=\"addcommentform\">";
if (empty($_POST)) {
$t .= "<form method=\"post\" action=\"$sn?$su\">";
$t .= "<p>".tag('input type="hidden" name="pic" value="'.$pic.'"')."</p>";
$t .= "<p>".tag('input type="hidden" name="page" value="'.$page.'"')."</p>";
$t .= "<p>".tag('input type="hidden" name="action" value="writecomment"')."</p>";
$t .= "<p>".$plugin_tx['gallery']['form_name'].tag('br').tag('input type="text" name="comment_name" size="26" class="gallery_comment_form"')."</p>";
$t .= '<p><img src="http://www.example.hu/plugins/gallery/c ... w.php?sid=' . md5(uniqid(time())) . '" />' . tag('br') . '</p>';
$t .= "<p>".tag('input type="text" name="code" class="gallery_comment_form"')."</p>";
$t .= "<p>".$plugin_tx['gallery']['form_comment'].tag('br')."<textarea rows=\"3\" name=\"comment_text\" cols=\"21\" class=\"gallery_comment_form\"></textarea>"."</p>";
$t .= "<p>".tag('input type="submit" value="'.$plugin_tx['gallery']['add_comment'].'" class="gallery_submit"')."</p>";
$t .= "</form></div></div>";
$t .= "</fieldset>";
} else {
include './plugins/gallery/captcha/securimage.php';
$img = new Securimage();
$valid = $img->check($_POST['code']);
if($valid == true) {
return $t;
} else {
echo "<center>Sorry, the code you entered was invalid. <a href=\"javascript:history.go(-1)\">Go back</a> to try again.</center>";
}
}
}
gallery problem
Moderator: Tata
gallery problem
cmsimpleforum.com best CMSimple community!
Re: gallery problem
Hi madar,
I've integrated the securimage captcha into the gallery plugin.
Please be patient, the version will be available in the next days.
A little demo, without comments, is available at my playground:
http://www.HolgerIrmler.de/playground
Holger
I've integrated the securimage captcha into the gallery plugin.
Please be patient, the version will be available in the next days.
A little demo, without comments, is available at my playground:
http://www.HolgerIrmler.de/playground
Holger
Re: gallery problem
Ok, but what means "next days" please ? Because I've got only 5 days to do this. Thanks for reply
cmsimpleforum.com best CMSimple community!
Re: gallery problem
I'm not sure .madar wrote:Ok, but what means "next days" please ? Because I've got only 5 days to do this. Thanks for reply
So here's my code for the integration of securimage captcha:
In idex.php:
Code: Select all
//Add comment
if ($pic <> '' and $action == 'writecomment') {
//HI Validate input & captcha and return to form on errors
$gallery_comment = true;
include_once $pth['folder']['plugins'].$plugin.'/securimage/securimage.php';
$securimage = new Securimage();
if ($securimage->check($_POST['captcha_code']) == false) {
$t .= '<div class="gallery_comment_error">• '.$plugin_tx['gallery']['captcha_error'].'</div>';
$gallery_comment = false;
}
if ($_POST['comment_name'] == '') {
$t .= '<div class="gallery_comment_error">• '.$plugin_tx['gallery']['comment_name_error'].'</div>';
$gallery_comment = false;
}
if ($_POST['comment_text'] == '') {
$t .= '<div class="gallery_comment_error">• '.$plugin_tx['gallery']['comment_text_error'].'</div>';
$gallery_comment = false;
}
if ($gallery_comment == false) {
$t .= tag('br');
$t .= AddComment($dir,$pic);
return $t;
} //HI End captcha and input validation
else
function AddComment($dir, $pic):
Code: Select all
...
$t .= "<form method=\"post\" action=\"$sn?$su\">";
$t .= tag('input type="hidden" name="pic" value="'.$pic.'"');
$t .= tag('input type="hidden" name="page" value="'.$page.'"');
$t .= tag('input type="hidden" name="action" value="writecomment"');
$t .= "<p>".$plugin_tx['gallery']['form_name'].tag('br').tag('input type="text" name="comment_name" size="26" class="gallery_comment_form"')."</p>";
$t .= "<p>".$plugin_tx['gallery']['form_comment'].tag('br')."<textarea rows=\"8\" name=\"comment_text\" cols=\"21\" class=\"gallery_comment_form\"></textarea>"."</p>";
//HI Start Captcha Code
$t .= "<p>".$plugin_tx['gallery']['captcha_heading'].tag('br').tag('img id="captcha" src="'.$pth['folder']['plugins'].'gallery/securimage/securimage_show.php." alt="CAPTCHA Image" class="gallery_captcha"')." "."</p>";
$t .= "<p>";
$t .= $plugin_tx['gallery']['captcha_verify_code']." ".tag('input type="text" name="captcha_code" size="10" maxlength="4" class="gallery_comment_form"')." ";
$t .= "<a class=\"gallery_comment_form\" href=\"#\" onclick=\"document.getElementById('captcha').src = '".$pth['folder']['plugins']."gallery/securimage/securimage_show.php?' + Math.random(); return false\">".$plugin_tx['gallery']['captcha_reload']."</a>";
$t .= "</p>";
//HI End Captcha Code
$t .= "<p>".tag('input type="submit" value="'.$plugin_tx['gallery']['add_comment'].'" class="gallery_submit"')."</p>";
... </form>
New variables are:
- $plugin_tx['gallery']['captcha_verify_code']
- $plugin_tx['gallery']['captcha_reload']
- $plugin_tx['gallery']['captcha_error']
Holger
Re: gallery problem
Now it works perfetc, thanks Holger !
cmsimpleforum.com best CMSimple community!
Re: gallery problem
Done all, you can close this topic, thanks for help
cmsimpleforum.com best CMSimple community!