Captcha oddities and two questions

Hi there!

I want to use the captcha functionality. At my local test system it all workes fine, i enabled the captcha via the administration interface a few nightly versions ago, created my theme and did a littlebit of tweaking it, until it looked as i wanted it to look.

Then i uploaded the theme to my web server and it worked good. Then i recognized, that the comments captcha is not visible in the online version of my gallery. Well, i looked around in the administration interface of zenphoto, to activate the “use captcha” option, but there isn’t any?!

I went back to my local version and searched for such an option here, but the same: no “enable commetns captcha” option. The same in `zp-config.php`: No options to enable the comments captcha. But there were one, once. If there weren’t any, how could i enable the captcha?

I compared the databases. At my local database in `[prefix]_options` are `Use_Captcha` set to `1` and `last_captcha_purge` set to `1202588143`. This two database entries are not in the database, which is used by the online version of my gallery.

Another thing is: Why are all captcha images are stored in the cache directory as `code_[random hexadecimal number].png` and not been deleted after the comment was done?

Comments

  • Captcha is a theme option.

    The captcha images are deleted daily. They are created when the page is visited. The user may not post a comment, so not create an opportunity to delete them on comment posting.
  • A theme problem in the administration interface?

    As i said: The captcha works in my local development version, but not in my online version. Same version, same theme. But in the local development version i enabled the captcha a while ago. The captcha informations are stored in the database which is used by my local development version, but not in the database used by my online version - and i cant find an option to enable it.

    Code according to the captcha:

    `<?php if (getOption('Use_Captcha')) { $captchaCode=generateCaptcha($img); ?>

    [PHP code for displaying the captcha image and the input field]

    <?php } ?>`

    And in my local development version it works, because `Use_Captcha` is stored in the database. In my online version it dont works (rep. it works, but the if statement returns `false`) and nothing is displayed.

    Where is the "enable captcha for comments" option in the administration interface?
  • trisweb Administrator
    What version of Zenphoto are you running on your server? Captcha is a recent development, so you should be running the latest to use it.

    If you are running the latest, try running an upgrade (setup.php) to try to re-create the database entry.

    Otherwise, try making the entry yourself? Not sure why it's not there if it's not those reasons.
  • As I said, it is a theme option, therefore it is on the admin theme options page. If you don't see it there, then maybe the theme you are using does not support it.
  • @trisweb: nightly 2008-02-07 (because the preview images in 2008-02-08 dont have the watermark). I ran setup.php and had a look at the options: no “use captcha” option available and captcha is not used at the comments. And no, i dont want to botch around in the database just because of the missing captcha usage information (and the missing option in the administration interface)

    @sbillard: where exactly do i have to look? I didnt change anything in `zp-core`, only the configuration file for the database connection. and i didnt change anything in `themes`, i only added my own theme. In the “Options” tab are some sub-tabs, i had a look at all of them: no option to enable the captcha. At the “Theme options” tab, “Allow comments:” checked, “Allow search:” checked, “Theme colors:” at “default”.

    Please navigate me to the “admin theme options page” you mentioned. (i dont even knew, that there is an admin theme)

    Edit: I solved this problem by doing the following:

    1. selected the default theme
    2. ran setup.php again
    3. had a look at the options. woah! the captcha option is there!
    4. Enabled the option
    5. switched back to my theme, and yes, the option disappeared, but the captcha now works.

    Btw.: i dont want to tamper with your great work, but it is a good thing, to connect the “use captcha” option with the selected theme? Its like allowing a GUI designer to interfere with the core functions of a program (kinda *g*).

    Just to make myself clear: the database entry was first written, AFTER i ran setup.php after i set the default theme as the theme.
  • WOAH!

    There were more than 5000 captcha images created in the cache folder, just a few hours after i found out, how to use the captcha! Maybe deleting the captcha files once a day works for small galleries with a few visitors a day, but not for big galleries with a few hundred visitors in just one hour.

    You definitely should consider using sessions instead of temporary dumping the files in the image cache folder.
  • The files are the actual image. Not sure how to do that with sessions. Could change the delete frequency to a shorter time, though. But, you have to leave them long enough to let the person make a comment.
  • So you use the image to check, if the input was correct? Well, this is no security at all, if my site is spammed by a professional spam bot, but just annoyance for my visitors :(

    Thanks god, i can use the Akismet API key from my blog in zenphoto, too. I hope, that is enough protection (well, my Wordpress blog is protected by Akismet very good, so it works, basically *g*) against comments spam. Now i’m going to disable the captcha (unless it was kinda hard, to get the option for enabling it *g*) and delete about 800 captcha images ;)

    Thanks anyways!
  • No, it does not use the image to check anything, it uses the image to display the image.

    Disabling the option will remove the images.
  • DirkSohler:

    If you want your theme to support captcha (which I understand you may no longer wish) as an option, then it needs to declare so in it's supported options. (themeoptions.php) The option is there because themes participate in the use of captcha.

    For instance, to make it optional you write
    ` <?php if (getOption('Use_Captcha')) { <br />
    echo "
    ";

    printCaptcha('', '', ' Enter Captcha', 8);

    } ?>`

    If you want to make it mandatory for your theme you can always call `setOption("Use_Captcha", false);` (The optional 'false' parameter makes the setting transient to the script that sets the option.)
Sign In or Register to comment.