Support Forum Project Downloads FAQ Documentation About Demo Tutorials Blog Plugins
November 21, 2009, 10:25:01 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Private messages disabled
Caused by the massive abuse of the PM system in the past, the sending of personal messages has been disabled for all regular users on the Coppermine forum.
[more]
   Home   Help Search Board rules Login Register  
Pages: 1 2 3 4 [5] 6 7 8 9 ... 23   Go Down
  Print  
Author Topic: Captcha (Visual Confirmation) for adding comments  (Read 196837 times)
0 Members and 1 Guest are viewing this topic.
tyio
Coppermine novice
*
Posts: 27


« Reply #80 on: September 01, 2006, 03:38:09 pm »

for those who style have some problem, edit theme.inc.php


add :


Quote
'{CONFIRM}' => $lang_display_comments['confirm'],


after

Quote
'{COMMENT}' => $lang_display_comments['comment'],




then add

Quote
<tr>
  <td class="tableb_compact" colspan="2">
    {CONFIRM}
  </td>
  <td class="tableb_compact" colspan="2">
    <input type="text" name="confirmCode" size="5" class="textinput"> <img src="captcha.php" align="middle">
  </td>
</tr>


after (style of your website depending Wink)

Quote
<!-- END input_box_no_smilies -->




and do the others change ^^
Logged
gymnastdude182
Coppermine regular visitor
**
Posts: 72


« Reply #81 on: September 02, 2006, 03:24:01 am »

In my gallery, the confirmation image does not show up anymore. I don't know what happened to it. Example:

http://www.britneyres.com/displayimage.php?album=1935&pos=1
Logged
gymnastdude182
Coppermine regular visitor
**
Posts: 72


« Reply #82 on: September 02, 2006, 03:37:45 am »

also, when I go to http://www.britneyres.com/captcha.php it says:

Quote
Fatal error: Call to undefined function: imageftbbox() in /home/britneyr/public_html/include/captcha.class.php on line 115
Logged
Abbas Ali Topic starter
Administrator
*****
Gender: Male
India India

Posts: 2087


Spread the PHP Web


WWW
« Reply #83 on: September 02, 2006, 06:29:34 am »

@gymnastdude182: Was the image beign shown previously? If yes, then it means that your webhost changed something in php setup and freetype2 is no longer supported on your server.
Logged

--- Love is blind, wish it was mute too ---
Visit me @ www.abbasali.net
gymnastdude182
Coppermine regular visitor
**
Posts: 72


« Reply #84 on: September 02, 2006, 07:58:25 am »

@gymnastdude182: Was the image beign shown previously? If yes, then it means that your webhost changed something in php setup and freetype2 is no longer supported on your server.
He told me he did not edit any of that   Sad what happened? Is it because I input a 404 error page? I removed that and it still does not work. That's the only thing I can think of that I edited.
Logged
Gizmo
Dev Team member
****
Gender: Male
Posts: 1015



WWW
« Reply #85 on: September 02, 2006, 05:30:29 pm »

Well, it finally happened to me. I started getting porn spam on my youths sports gallery - http://www.bullseyephotos.com/sports/index.php. Good thing that I have email notification set up for everything that happens on that site otherwise some young person or parent might have seen it and I would have been clobbered. I was able to install this mod in 5 minutes following Abbas' instructions in the initial post in my gallery which is heavily modded without any issues. Excellent work and many thanks Abbas!  Grin

Cheers,

Gizmo
Logged

Did you read the manual first?Huh Taking 2 minutes to backup your files can save you hours of wondering what you screwed up.
Billy Bullock - BullsEyePhotos Blog of Indecision
mvyvoda
Coppermine newbie

Posts: 6


« Reply #86 on: September 02, 2006, 08:18:42 pm »

@mvyvoda: Did you modified captcha.php file? When http://www.derpishi.com/gallery/captcha.php is opened, it should show an image. But in your case the page comes blank. Also do you have error messages turned off on your server?

here's the error message i now see on http://www.derpishi.com/gallery/captcha.php:
Quote
Fatal error: Call to undefined function imageftbbox() in /home/vyvodamr/public_html/gallery/include/captcha.class.php on line 115

my ISP doesn't know what's up with this. could it be something with the captcha.class.php code? any suggestions are more than welcome and I appreciate the time and energy of your help!!! currently, i've turned off commenting for unregistered users. please advise if you need me to turn it back on.

thanks a lot!,
mark
Logged
Nibbler
Dev Team member
****
Gender: Male
United Kingdom United Kingdom

Posts: 19445



WWW
« Reply #87 on: September 02, 2006, 08:55:32 pm »

It means you don't have freetype support on your server.
Logged

I don't care about what they say, I won't live or die that way.
Bonato
Coppermine newbie

Posts: 11


WWW
« Reply #88 on: September 03, 2006, 06:07:07 am »

Well, well... I find this mod very interesting and useful, but I was not able to do the modifications and get this thing to work. I'm very illiterate regarding code. I will have to find another solution to avoid those freaking spammers.

But thank you Abbas Ali, anyway.
Logged
musikalg
Translator
**
Gender: Male
Posts: 17


WWW
« Reply #89 on: September 04, 2006, 01:24:44 am »

Wonderful hack! Just a minor comment, if you're using another language than english it might be a good idea to use:

Code:
require("include/captcha.class.php");
        if (!PhpCaptcha::Validate($_POST['confirmCode'])) {
          cpg_die(ERROR, $lang_errors['captcha_error'], __FILE__, __LINE__);
        }

instead of

   
Code:
require("include/captcha.class.php");
        if (!PhpCaptcha::Validate($_POST['confirmCode'])) {
          cpg_die(ERROR, "Confirmation code didn't matched", __FILE__, __LINE__);
        }

in db_input.php

/Jimmy
Logged
musikalg
Translator
**
Gender: Male
Posts: 17


WWW
« Reply #90 on: September 04, 2006, 01:50:02 am »

I made a small modification so users who are logged in don't need to confirm, while anonymous users has to.
I haven't tested how secure this is, but it seems to work. My modification for theme.php is written for the Project VII-theme, you have to adjust it for your own theme. The trick is to write two versions of $template_add_your_comment, one for users who are logged in and one for those who aren't.

I just write the modifications necessary after you have done Abbas Alis modifications.

In db_input.php:

Instead of
Code:
require("include/captcha.class.php");
        if (!PhpCaptcha::Validate($_POST['confirmCode'])) {
          cpg_die(ERROR, "Confirmation code didn't matched", __FILE__, __LINE__);
        }

write

Code:
if (!USER_ID) {require("include/captcha.class.php");
        if (!PhpCaptcha::Validate($_POST['confirmCode'])) {
          cpg_die(ERROR, $lang_errors['captcha_error'], __FILE__, __LINE__);
        } }

In theme.php, instead of

Code:
$template_add_your_comment = <<<EOT
        <form method="post" name="post" action="db_input.php">
                <table align="center" width="{WIDTH}" cellspacing="1" cellpadding="0" class="maintable">
                        <tr>
                                        <td width="100%" class="tableh2_compact"><b>{ADD_YOUR_COMMENT}</b></td>
                        </tr>
                        <tr>
                <td colspan="1">
                        <table width="100%" cellpadding="0" cellspacing="0">

<!-- BEGIN user_name_input -->
                                                        <tr>
                                                                <td class="tableb_compact">
                                        {NAME}
                                </td>
                                <td class="tableb_compact">
                                        <input type="text" class="textinput" name="msg_author" size="10" maxlength="20" value="{USER_NAME}" />
                                </td>
<!-- END user_name_input -->
<!-- BEGIN input_box_smilies -->
                                <td class="tableb_compact">
                                {COMMENT}
                                                                </td>
                                <td width="100%" class="tableb_compact">
                                <input type="text" class="textinput" id="message" name="msg_body" onselect="storeCaret_post(this);" onclick="storeCaret_post(this);" onkeyup="storeCaret_post(this);" maxlength="{MAX_COM_LENGTH}" style="width: 100%;" />
                                                                </td>
<!-- END input_box_smilies -->
<!-- BEGIN input_box_no_smilies -->
                                <td class="tableb_compact">
                                {COMMENT}
                                                                </td>
                                <td width="100%" class="tableb_compact">
                                <input type="text" class="textinput" id="message" name="msg_body"  maxlength="{MAX_COM_LENGTH}" style="width: 100%;" />
                                </td>
<!-- END input_box_no_smilies -->
                                <td class="tableb_compact">
                                <input type="hidden" name="event" value="comment" />
                                <input type="hidden" name="pid" value="{PIC_ID}" />
                                <input type="submit" class="comment_button" name="submit" value="{OK}" />
                                </td>
                                                        </tr>
                                                        <<tr>
  <td class="tableb_compact" colspan="2">
    {CONFIRM}
  </td>
  <td class="tableb_compact" colspan="2">
    <input type="text" name="confirmCode" size="5" class="textinput"> <img src="captcha.php" align="middle">
  </td>
</tr>
                        </table>
                </td>
        </tr>
<!-- BEGIN smilies -->
        <tr>
                <td width="100%" class="tableb_compact">
                        {SMILIES}
                </td>
        </tr>
<!-- END smilies -->
                </table>
        </form>
EOT;

paste
Code:
if (!USER_ID) {
$template_add_your_comment = <<<EOT
        <form method="post" name="post" action="db_input.php">
                <table align="center" width="{WIDTH}" cellspacing="1" cellpadding="0" class="maintable">
                        <tr>
                                        <td width="100%" class="tableh2_compact"><b>{ADD_YOUR_COMMENT}</b></td>
                        </tr>
                        <tr>
                <td colspan="1">
                        <table width="100%" cellpadding="0" cellspacing="0">

<!-- BEGIN user_name_input -->
                                                        <tr>
                                                                <td class="tableb_compact">
                                        {NAME}
                                </td>
                                <td class="tableb_compact">
                                        <input type="text" class="textinput" name="msg_author" size="10" maxlength="20" value="{USER_NAME}" />
                                </td>
<!-- END user_name_input -->
<!-- BEGIN input_box_smilies -->
                                <td class="tableb_compact">
                                {COMMENT}
                                                                </td>
                                <td width="100%" class="tableb_compact">
                                <input type="text" class="textinput" id="message" name="msg_body" onselect="storeCaret_post(this);" onclick="storeCaret_post(this);" onkeyup="storeCaret_post(this);" maxlength="{MAX_COM_LENGTH}" style="width: 100%;" />
                                                                </td>
<!-- END input_box_smilies -->
<!-- BEGIN input_box_no_smilies -->
                                <td class="tableb_compact">
                                {COMMENT}
                                                                </td>
                                <td width="100%" class="tableb_compact">
                                <input type="text" class="textinput" id="message" name="msg_body"  maxlength="{MAX_COM_LENGTH}" style="width: 100%;" />
                                </td>
<!-- END input_box_no_smilies -->
                                <td class="tableb_compact">
                                <input type="hidden" name="event" value="comment" />
                                <input type="hidden" name="pid" value="{PIC_ID}" />
                                <input type="submit" class="comment_button" name="submit" value="{OK}" />
                                </td>
                                                        </tr>
                                                        <tr>
  <td class="tableb_compact" colspan="2">
    {CONFIRM}
  </td>
  <td class="tableb_compact" colspan="2">
    <input type="text" name="confirmCode" size="5" class="textinput"> <img src="captcha.php" align="middle">
  </td>
</tr>
                        </table>
                </td>
        </tr>
<!-- BEGIN smilies -->
        <tr>
                <td width="100%" class="tableb_compact">
                        {SMILIES}
                </td>
        </tr>
<!-- END smilies -->
                </table>
        </form>
EOT;
}
else
{
$template_add_your_comment = <<<EOT
        <form method="post" name="post" action="db_input.php">
                <table align="center" width="{WIDTH}" cellspacing="1" cellpadding="0" class="maintable">
                        <tr>
                                        <td width="100%" class="tableh2_compact"><b>{ADD_YOUR_COMMENT}</b></td>
                        </tr>
                        <tr>
                <td colspan="1">
                        <table width="100%" cellpadding="0" cellspacing="0">

<!-- BEGIN user_name_input -->
                                                        <tr>
                                                                <td class="tableb_compact">
                                        {NAME}
                                </td>
                                <td class="tableb_compact">
                                        <input type="text" class="textinput" name="msg_author" size="10" maxlength="20" value="{USER_NAME}" />
                                </td>
<!-- END user_name_input -->
<!-- BEGIN input_box_smilies -->
                                <td class="tableb_compact">
                                {COMMENT}
                                                                </td>
                                <td width="100%" class="tableb_compact">
                                <input type="text" class="textinput" id="message" name="msg_body" onselect="storeCaret_post(this);" onclick="storeCaret_post(this);" onkeyup="storeCaret_post(this);" maxlength="{MAX_COM_LENGTH}" style="width: 100%;" />
                                                                </td>
<!-- END input_box_smilies -->
<!-- BEGIN input_box_no_smilies -->
                                <td class="tableb_compact">
                                {COMMENT}
                                                                </td>
                                <td width="100%" class="tableb_compact">
                                <input type="text" class="textinput" id="message" name="msg_body"  maxlength="{MAX_COM_LENGTH}" style="width: 100%;" />
                                </td>
<!-- END input_box_no_smilies -->
                                <td class="tableb_compact">
                                <input type="hidden" name="event" value="comment" />
                                <input type="hidden" name="pid" value="{PIC_ID}" />
                                <input type="submit" class="comment_button" name="submit" value="{OK}" />
                                </td>
                                                        </tr>
                                                       
                        </table>
                </td>
        </tr>
<!-- BEGIN smilies -->
        <tr>
                <td width="100%" class="tableb_compact">
                        {SMILIES}
                </td>
        </tr>
<!-- END smilies -->
                </table>
        </form>
EOT;
}

This seems like a bit unnecessary complicated, but I couldn't get it working in any other way.

/Jimmy
« Last Edit: September 04, 2006, 02:05:48 am by musikalg » Logged
gymnastdude182
Coppermine regular visitor
**
Posts: 72


« Reply #91 on: September 04, 2006, 09:27:27 am »

It means you don't have freetype support on your server.
my host says we do. what now  Huh how can I fix this?
Logged
Joachim Müller
Administrator
*****
Gender: Male
Germany Germany

Posts: 45051


aka "GauGau"


WWW
« Reply #92 on: September 04, 2006, 07:28:46 pm »

Check phpinfo, look for the GD section, see if freetype is actually there. Should look similar to http://coppermine-gallery.net/demo/cpg14x/docs/faq.htm#VersionGD
Logged
mvyvoda
Coppermine newbie

Posts: 6


« Reply #93 on: September 04, 2006, 09:32:24 pm »

freetype is now installed and i can see the captcha image!!!!!! thanks for all the help. I am still having a problem however. It seems as though the confirmation image doesn't work properly because I can comment w/o typing the captcha image.

did i do something in correct w/ modding the code?

thanks for the help. i do appreciate it!
-m
Logged
Joachim Müller
Administrator
*****
Gender: Male
Germany Germany

Posts: 45051


aka "GauGau"


WWW
« Reply #94 on: September 04, 2006, 09:50:15 pm »

for those who style have some problem, edit theme.inc.php
Don't do as tyio suggested. You must never edit include/themes.inc.php - under no circumstances.
Logged
TranzNDance
Dev Team member
****
Gender: Female
United States United States

Posts: 6138



WWW
« Reply #95 on: September 05, 2006, 12:03:56 am »

I am still having a problem however. It seems as though the confirmation image doesn't work properly because I can comment w/o typing the captcha image.

did i do something in correct w/ modding the code?

Did you not edit db_input.php? That's the part that tests for whether the confirmation code is correct.
Logged

mvyvoda
Coppermine newbie

Posts: 6


« Reply #96 on: September 05, 2006, 12:40:18 am »

Did you not edit db_input.php? That's the part that tests for whether the confirmation code is correct.

ah yes... i made a mistake there.

thanks again everyone. it works perfectly now!,
-m
Logged
Fudgemaster
Coppermine novice
*
Gender: Male
Posts: 45



WWW
« Reply #97 on: September 05, 2006, 03:15:39 am »

Niiiice.

Just edited the files to make it work.
Didn't have freetype2 in my webhotel but after contacting my provider they gave me a newer server with more phun stuff to play around.

Thank you for the mod Abbas Smiley

(offcourse, I had to get the first pr0n spam comments to my gallery to get this done (g*ay links to a BMW picture Wink )
Logged

--
It's an insane world.. But I'm proud to be a part of it.
davidcross100
Coppermine newbie

Posts: 2


« Reply #98 on: September 06, 2006, 10:53:21 am »

Sorry for such a basic question but I'm new to all this PHP stuff. I;ve just taken over a website that is being bombarded with spam. Am going to try this out but falling down at the 1st hurdle - where can I find my 'Coppermine Root Directory?'

I've searched in all the folders of the website but can't find it! Again, sorry for the basic question but is it really obvious where it is?
Logged
davidcross100
Coppermine newbie

Posts: 2


« Reply #99 on: September 06, 2006, 11:05:53 am »

Sorry everyone - I've just found it all. But I think I will have to upgrade the gallery I have as I think it is a bit out of date - some of the code mentioned doesn't exist in my coding.

However, is it right that when I download the file it only has 4 files and nothing about fonts that was mentioned in the original post?
Logged
Pages: 1 2 3 4 [5] 6 7 8 9 ... 23   Go Up
  Print  
 
Jump to:  

Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
Page created in 0.106 seconds with 15 queries.