Author Topic: [MOD] Registration with security code validation v1.0  (Read 101085 times)

0 Members and 1 Guest are viewing this topic.

Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Re: [MOD] Registration with security code validation v1.0
« Reply #45 on: April 25, 2006, 12:14:22 PM »
how can I integration these mod into the comments?
I white, it is more simply the existing mod to be inserted than again freshly to begin a new mod!!
you are absolutely right !!! no need of several mod to do the same thing but it helps the creativity should never be killed   :wink:

if you want to apply this mod to protect your comments, then follow these steps (after installing the first part) :

Step 1.1 :
open details.php
 find :
Code: [Select]
if ($comment_text == "")  {
      $msg .= (($msg != "") ? "<br />" : "").$lang['comment_required'];
      $error = 1;
    }

add after:
Code: [Select]
$code = $site_sess->get_session_var("rnd_code");
    if (!$code || !isset($HTTP_POST_VARS['code']) || empty($HTTP_POST_VARS['code']))
    {
      $msg .= (($msg != "") ? "<br />" : "").$lang['rndimg_required'];
      $error = 1;
    }
    elseif (strtoupper(trim($HTTP_POST_VARS['code'])) != $code)
    {
      $msg .= (($msg != "") ? "<br />" : "").$lang['rndimg_missmatch'];
      $error = 1;
    }

Step 1.2 :
still in details.php
find:
Code: [Select]
$comment_headline = (isset($HTTP_POST_VARS['comment_headline']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_headline'])), 2) : "";
    $comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_text'])), 2) : "";

and add after:
Code: [Select]
include(ROOT_PATH."rndimg.php");
    $site_template->register_vars(array(
      "lang_rndimg" => $lang['rndimg'],
      "lang_rndimg_expl" => $lang['rndimg_expl'],
      "rndimg_url" => $site_sess->url(ROOT_PATH."rndimg.php?".MD5(time()), "&")."&",
    ));

Step 2 :
Open templates/<your template>/comment_form.html
find :
Code: [Select]
<input type="submit" name="postbutton" value="{lang_post_comment}" class="button" />
and add somewhere before :
Code: [Select]
          <tr>
            <td class="row2"><b>{lang_rndimg}:</b><br /><img src="{rndimg_url}" onClick="this.src='{rndimg_url}'+((Math.round(Math.random()*(999-100)))+100);"></td>
            <td class="row2" valign="top"><input type="text" name="code" size="5" value="" /><br /><span class="smalltext">{lang_rndimg_expl}</td>
          </tr>

That's all  :wink:
ch€ri{Bi}²


Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Re: [MOD] Registration with security code validation v1.0
« Reply #46 on: April 25, 2006, 09:34:49 PM »
There is also a little config that you can play with, which allow you to change size of the image, size of font, font color (shade of grey actualy)
@V@no:
 :?: is there a particular reason to keep this font color?

 :arrow: i tried to change the $rgb variable in rndimg.php with differents values...
Quote
$color = ImageColorAllocate($im, $rgb,$rgb,$rgb);
but only the 2 first letters get their color changed  :?

:?: so how can i change the font color for all letters?

Thanks!
ch€ri{Bi}²


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Registration with security code validation v1.0
« Reply #47 on: April 25, 2006, 11:52:25 PM »
the $rgb value is being generated based on C_MIN and C_MAX constants.
So, if you want have one specific color (actualy brighnes), then set these constants to the same value.
or if you wish, you can specify different color for all letters by replacing $rgb with a number (0 - 255):[qcode]$color = ImageColorAllocate($im, red, green[/i], blue);[/qcode]
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Re: [MOD] Registration with security code validation v1.0
« Reply #48 on: April 26, 2006, 12:35:50 AM »
 yes v@no  :?  you are right surely but if I replace the $color code by this one:
Code: [Select]
$color = ImageColorAllocate($im, mt_rand(0, 255),mt_rand(0, 255),mt_rand(0, 255));
you can see and test the result here (and refresh it...): it works for only 1 or 2 letters! the others letters don't take the color  :!:
ch€ri{Bi}²


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Registration with security code validation v1.0
« Reply #49 on: April 26, 2006, 12:49:52 AM »
Oh, I see. you will also need make the image 24bit:[qcode]  $im = ImageCreateTrueColor(WIDTH,HEIGHT);
[/qcode]
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Re: [MOD] Registration with security code validation v1.0
« Reply #50 on: April 26, 2006, 01:02:03 AM »
yeah, yeah, yeah, v@no, you got it!  :wink:
Thank you very much!

i did not say it before for this mod : very great job! :D

ch€ri{Bi}²


Offline cookie

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: [MOD] Registration with security code validation v1.0
« Reply #51 on: May 27, 2006, 02:58:23 PM »
Just curious, I've got GD installed, but without TrueType Font support.

How difficult is it to enable TrueType Support?

I manage my own dedicated server with WHM/Cpanel, so I have the authority and the rights to manage my server.

Any ideas?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Registration with security code validation v1.0
« Reply #52 on: May 27, 2006, 07:11:46 PM »
You'll have to recompile PHP for that...
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline leh00

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: [MOD] Registration with security code validation v1.0
« Reply #53 on: May 28, 2006, 03:32:46 PM »
Hi there Vano,

I'm stocked into some problems with your [mod]

What I did:
- I installed 4Images v1.7.2
- I extracted the zip and the test is successfull
- I added code of Step 2
- I added code of Step 2.1
- I added the text messages to the main.php of both languages
- I modified the register_form.html

but when I open the register form the text of {lang_rndimg} and {rndimg_url} are empthy.

When I replace the {lang_rndimg} with {lang_email} the email text shows up... When I add a new text like $lang['email3'] = "Email:"; then {lang_email3} stays empthy too...

Is there something else I need to do?

Any help is appreciated.

Hanspeter

Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: [MOD] Registration with security code validation v1.0
« Reply #54 on: May 28, 2006, 05:58:04 PM »
Thanks V@no for this mod...

I started to get bots joining and spamming my comment section bad, untill i added this mod.. now all is clear.  8)

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Registration with security code validation v1.0
« Reply #55 on: May 28, 2006, 07:10:43 PM »
@leh00:
Probably you made a misstake in Step 2.1
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline leh00

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: [MOD] Registration with security code validation v1.0
« Reply #56 on: May 28, 2006, 09:18:39 PM »
Hi V@no,

thanks für your replay - ich checked Step 2.1 again and I found the mistake... I added the code to [qcode]if (!$error) {[/qcode] instead of [qcode]if ($error) {[/qcode]

Now it works perfekt...

Thanks a lot

Hanspeter

Offline cookie

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: [MOD] Registration with security code validation v1.0
« Reply #57 on: May 30, 2006, 05:41:12 PM »
For those that are interested, you must recompile Apache. 

You must enable "Freetype support" for the PHP Module when you re-compile Apache.  You must also have GD Library enabled for the PHP module as well, but that is fairly obvious.

Offline Momo

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: [MOD] Registration with security code validation v1.0
« Reply #58 on: October 02, 2006, 01:23:41 PM »
Could you give me the file please? I have a lot of problems with spam.

Regards Momo

Offline comicart

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re: [MOD] Registration with security code validation v1.0
« Reply #59 on: October 02, 2006, 01:26:42 PM »
Could you give me the file please? I have a lot of problems with spam.

This feature is "built in" with version 1.7.3
I recommend you upgrade.

T