4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: V@no on October 27, 2005, 02:58:03 AM
-
This mod is usefull against auto-registrations, bots. It will display a picture with random code and visitor must type the code in the field.
(http://img326.imageshack.us/img326/2066/code8kr.png)
As of v1.0 this mod works only with GD, no ImageMagick or NetPBM is supported. Also, GD must be compilled with TrueType library (you can check it in phpinfo())
--------[ Installation ]----------
Step 1
Download this (http://gallery.vano.org/file69dl) package.
Unzip it and upload all files to the root of your 4images installation and restore the following file-tree:
rndimg.php
fonts/comicbd.tff
bg/1.png
bg/2.png
bg/3.png
CHMOD 666 all files
Try to execute rndimg.php by typing in your browser: http://example.com/4images/rndimg.php
If you see an image with code, then you can continue to the next step, otherwise its possible this mod will not work for you at all.
Step 2
Open register.php
Find: else {
$msg .= (($msg != "") ? "<br />" : "").$field_error = preg_replace("/".$site_template->start."field_name".$site_template->end."/siU", str_replace(":", "", $lang['email']), $lang['field_required']);
$error = 1;
}
Insert below: $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 2.1
Find: if ($error) {
Insert below: 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 3
Open lang/<your langauge>/main.php
At the end, above closing ?> insert:$lang['rndimg'] = "Security code";
$lang['rndimg_expl'] = "Please type code from the image<br />Click the image to change it's background";
$lang['rndimg_required'] = "Security code is required";
$lang['rndimg_missmatch'] = "You have entered a wrong security code";
Step 4
Open templates/<your template>/register_form.html
Add <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>
(design is your task ;))
You can upload as many background images and fonts as you wish, no script changes required, the script will pick them randomly. The background images must be jpeg, gif or png type and should be bigger or equal then the WIDTH and HEIGHT settings that set in rndimg.php.
Fonts must be .ttf type.
The default number of letters in the "code" is set to 5, you can change it in rndimg.php in this line:function get_code($num = 5, $safe = 1, $norepeat = 0)
when $safe variable is set to true (1) the letters from this array:
$no = array("0","1","i","l","o","7"); //list of characters 0-9 and a-z to exclude from the list. lower case only!
will be filtered out from the "code", they will not be used. Set to false (0) if you dont want use the filter.
When $norepeat is set to true (1) it will ensure that no the same letter/number will be generated more then ones. Default is allow duplicate letters/numbers.
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)
If you would like integrate this mod into comments form, then you can follow ch€ri{Bi}² instructions from this post:
http://www.4homepages.de/forum/index.php?topic=10200.msg68176#msg68176
-
Great MOD. Thanks V@no :lol:
-
hi v@no,
excellent MOD ... great work ... thanks ... :D
-
Excellent mod 8)
Thank you
-
i've tried install it , but this give me error on Line : 117 any ideia ??? (in rndimg.php )
8O
-
Your server did not meet the minimum requirements:
GD with TrueType
It seems that your server has GD, but without TrueType.
-
not work for my.
say: La imagen “http://localhost:81/rndimg.php” no puede mostrarse, porque contiene errores.
http://luifer.no-ip.info/rndimg.php
http://luifer.no-ip.info/info.php
I have gd and FT.
Many thanks for the work.
-
Sorry, corrected.
I have: ./bg and ./fonts
I put: complete dir at line script. (D:\htdocs\WEB\luifer.no-ip.info\web\bg)
Thanks.
-
I get the same error-message like
Stoleti
i've tried install it , but this give me error on Line : 117 any ideia ??? (in rndimg.php )
I asked my provider and he told me GD Library allreday installed with TrueType -> that´s the path -> /usr/bin/GD
Edit: It works on localhost...
-
I asked my provider and he told me GD Library allreday installed with TrueType -> thatґs the path -> /usr/bin/GD
then please show me the link to your phpinfo (PM me if you dont want publish in public)
-
ok, here is the full error message:
Warning: imagettfbbox() [function.imagettfbbox]: Could not find/open font in /<path>/rndimg.php on line 117
as you see, it can not find the needed font file, the sollution is:
1) double check the permissions on the new files (perhaps try CHMOD 755)
2) double check that atleast one .ttf font file exists in fonts/ folder
3) try to use full local path instead of relative: define("FONTS_DIR", "/www/htdocs/v116307/lite/fonts"); //path to directory with fonts (.ttf only!)
-
Yeah, it was the path that´s strange 8O
One more time :oops: - thanks V@no :mrgreen:
Question: ther´re 3 backgrounds, can I change one of them, or delete 2 others ?
Edit: Okay, I know: Step 4 :)
-
Great Mod, Thanks for this. Works perfect....
-
Question: therґre 3 backgrounds, can I change one of them, or delete 2 others ?
Edit: Okay, I know: Step 4 :)
The backgrounds in the package are more like an example, you can add/delete as many as you wish, as long as there is atleast one image present in bg folder.
-
Hello,
No problem of startup. :P Thank you :wink:
-
Yes, the code is case insensetive, meaning it doesnt metter if capital letters were used or lower case.
-
i see this error:
Fatal error: Call to undefined function: imagettfbbox() in /home2/********/public_html/gallery/rndimg.php on line 117
i'm not sure if i have TrueType i can pm you phpinfo link
-
i'm not sure if i have TrueType i can pm you phpinfo link
Indeed, no TrueType is installed on your server.
-
i know for sure you can have registration code without truetype for example phpbb has it, if only i was a pro in php i would make one like phpbb has and integrate it into 4images, unfortunately i'm a newb to phpbb. :cry:
-
Hi everyone,
I have the GD libary compiled with FreeType and this mod actually works. But only if chmod for all is 777.
That means bg / fonts and rndimg.php with: read, write and execute for everyone.
So my question is: do I have a security problem, leaving chmod with 777 ?
Anyone an idea?
-
So my question is: do I have a security problem, leaving chmod with 777 ?
When people asking this question, I like to point them to this topic:
http://www.simplemachines.org/community/index.php?topic=2987
-
thanks for the link V@no
-
great mod, but... when i register an put the code, the system return me at the register form without register the user and go to next step, can anybody help me?
-
Maybe made a mistake in step 2.x ?
-
Check my site : http://vietnamphotos.net/register.php
It working good on localhost ( my computer with windows , apache .. ) but The code can not display on server linux ?
-
Warning: opendir(/home/muzic/domains/vietnamhotos.net/public_html/bg): failed to open dir: No such file or directory in /home/muzic/domains/vietnamphotos.net/public_html/rndimg.php on line 84
the error is self explained.
-
Where you find this error ???
Warning: opendir(/home/muzic/domains/vietnamhotos.net/public_html/bg): failed to open dir: No such file or directory in /home/muzic/domains/vietnamphotos.net/public_html/rndimg.php on line 84
i don't see it on my site !
-
when you open the image directly in the browser, it shows you that in more related error messages.
-
http://vietnamphotos.net/img9.htm like this , Vano? :cry: maybe i fixed ?
-
http://vietnamphotos.net/rndimg.php
-
Check this link : http://vietnamphotos.net/rndimg.php
Fatal error: Call to undefined function: imagettfbbox() in /home/muzic/domains/vietnamphotos.net/public_html/rndimg.php on line 117
What's problemt ?
-
The problem is that your server does not support "True type" and you can not use this mod. Sorry.
-
i try to join this mod with my guestbook but i got little problem. when i want post some message on my GB i don't see this random image. when i post message without this code than i see error_message "security code is required" and THEN i see this image with tis code.
i've got this GB on my site :
http://www.4homepages.de/forum/index.php?topic=7409.0
thanks for any help.
-
Hello V@no
Thanks for the great mod, as always, you rock!!! :D
when I try to access "rndimg.php" i am getting an "HTTP 500 Internal server error"
I have cmod all the files as per your instructions
previously I had installed another mod "[Mod] Image Annotation (Watermark)" and it works fine..
Where am I making the mistake?
Thanks a lot :D
-
without knowing what error logs are showing, I dont know.
-
error: file is writable by others: (/home/*****/public_html/ecard/rndimg.php)
[error] File does not exist: /home/*****/public_html/ecard/500.shtml
[error] Premature end of script headers: /home/*****/public_html/ecard/rndimg.php :?
Thanks
-
check file permissions
-
Thanks V@no :D
I got it working, excellent mod!!!
Also found out that it was my FTP client causing the problem :?, though I was setting the correct permission, the program was not uploading it correctly and setting it on server. now after a reset :idea:, it worked fine!
:D
-
gd
GD Support enabled
GD Version bundled (2.0 compatible)
FreeType Support enabled
FreeType Linkage with freetype
T1Lib Support enabled
GIF Read Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
I think it should work.. never had problems with GD support...
BUT ... this time just an error occours:
http://www.2fast4uextrem.de/gallery4all/rndimg.php
I chmoded right ! :-/
-
Could not find/open font
the error is self explained.
-
Yet another great mod EXCELLENT :D
-
The Zip file for step 1 is missing or Corrupted.
I can't seem to download it.
Can i have any other link or V@no can u update it ?
-
zip file works just fine
-
Thank you V@no, its a great Mod :D
-
There´s another MOD available which you can use for comments & guestbook!
Look here -> http://www.4homepages.de/forum/index.php?topic=11405.0
Ciao by Flo
-
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 (http://www.4homepages.de/forum/index.php?topic=10200.msg65606#msg65606)) :
Step 1.1 :
open details.php
find :
if ($comment_text == "") {
$msg .= (($msg != "") ? "<br />" : "").$lang['comment_required'];
$error = 1;
}
add after:
$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:
$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:
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 :
<input type="submit" name="postbutton" value="{lang_post_comment}" class="button" />
and add somewhere before :
<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:
-
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...
$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!
-
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]
-
yes v@no :? you are right surely but if I replace the $color code by this one:
$color = ImageColorAllocate($im, mt_rand(0, 255),mt_rand(0, 255),mt_rand(0, 255));
you can see and test the result here (http://patsgallery.free.fr/4images/rndimg_test.php) (and refresh it...): it works for only 1 or 2 letters! the others letters don't take the color :!:
-
Oh, I see. you will also need make the image 24bit:[qcode] $im = ImageCreateTrueColor(WIDTH,HEIGHT);
[/qcode]
-
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
-
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?
-
You'll have to recompile PHP for that...
-
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
-
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)
-
@leh00:
Probably you made a misstake in Step 2.1
-
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
-
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.
-
Could you give me the file please? I have a lot of problems with spam.
Regards Momo
-
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
-
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
How to upgrade, if I have a lot of modules? Is there anywhere a step-by-step-tutorial? It would be very helpful.
-
How to upgrade, if I have a lot of modules? Is there anywhere a step-by-step-tutorial? It would be very helpful.
Upgrade instructions are in the Download package - docs directory.
Mods would need to be reinstalled. Save your old files and compare if needed or just walk through the steps again through the Mod threads here on this board.
There's more than a few reasons to upgrade. Check the other threads all over this board for more details.
T
-
Okay, thanx. I have 2 installations. One of them I have integrated in phpbb. Does it work too?
-
Where is the pack to download?
-
Where is the pack to download?
http://www.4homepages.de/forum/index.php?topic=10200.msg57485#msg57485
Wouldn't it be easier to upgrade to 1.7.4 :?: This is added in that version, not to mention all the security fixes would be applied :!:
-
i wanna download,but all links are broken :cry: :cry:
-
Wouldn't it be easier to upgrade to 1.7.4 :?: This is added in that version, not to mention all the security fixes would be applied :!:
Please read this response again.
-
For those of us who have 1.7 set up with a lot of mods, plugins, manual modifications, etc... it would be total pain to upgrade to 1.7.4 or anything that'll come after these. I have not kept track of my mods, and I wouldn't know where to start. Unless I want to move over to a clean 1.7.4
This is a great mod, and I hope it will work as intended on my setup.
Thank You.
EDIT: Works Great! Thank You V@no
-
i finally install TTF to my serveri and finally able to see the picture of security code but now i got an error in registration.
Email Error: EHLO invalid mail server response: 220-We do not authorize the use of this system to transport unsolicited,
Do you have any idea about this?
PS: it is impossible to upgrade new version.
-
i finally install TTF to my serveri and finally able to see the picture of security code but now i got an error in registration.
Email Error: EHLO invalid mail server response: 220-We do not authorize the use of this system to transport unsolicited,
Do you have any idea about this?
PS: it is impossible to upgrade new version.
Now i solved that problem but now i get a new error. I hope this time someone will help me
whats this?
Warning: fsockopen() [function.fsockopen]: unable to connect to mail.domain.com:25 (Connection refused) in /home/user/public_html/includes/email.php on line 184
Warning: fgets(): supplied argument is not a valid stream resource in /home/user/public_html/includes/email.php on line 185
Email Error: Invalid mail server response (service not ready?):
in the line 184 and 185,
$fp = fsockopen($config['smtp_host'], 25);
$result = fgets($fp, 1024);
Anyone tel me what should i do?