Jump to content

anti spam image


Ch3vr0n

Recommended Posts

Hy there folks, on my website i have a couple forums that have been massively abused by robots and spiders lately. For the past couple days i have been looking for a php script (thats easy to embed in current form) but to no luck. The ones i did fid required the GD librairy ?? , or failed to show the image (even with the correct font uploaded).

Now my question is, can anybody script such a thing (pref without the GD librairy whatever it is), or know one ? Because without such a thing i cannot bring the forms back online (and they already have a scriptpart that checks for empty fields that are obligated).

Catch my drift, i really need this.
Link to comment
Share on other sites

with GD, my captcha script is at www.digitalmidget.com/php_noob2006/captcha.php

without GD you could use a fake image that either never changes or is randomly selected from a group - a sort of pseudo-captcha - along with the requisite 'values' in an array accessed by your checking script.
Link to comment
Share on other sites

k i upped your captcha script, but in the place of the image i'm getting a red cross (as with the other scripts), this means that the GD2 is not installed ? Can i load externally to your script, or can it be modified to a solid bg or something ? If it cannot and i have to ask my provider to install the GD librairy, where does he need to put it and what needs to be done, or is there an alternative. I'd rather have generated ones, then an array since the prior is more secure.
Link to comment
Share on other sites

You can check to see if you have the GD library installed by viewing your site's php information:

[code]<?php
phpinfo();
?>[/code]

Save as phpinfo.php, upload to your site, then visit it.  If you have GD installed, it'll appear in the list og goodies there.  GD2 and GD in general has been around long enough that any decent host would provide it as part of their hosting package ... espcially since it's open source and free.  Your host will know how to recompile php with GD support (if not, you need another host - fast).
Link to comment
Share on other sites

[quote]
gd
GD Support  enabled 
GD Version  bundled (2.0.28 compatible) 
FreeType Support  enabled 
FreeType Linkage  with freetype 
GIF Read Support  enabled 
GIF Create Support  enabled 
JPG Support  enabled 
PNG Support  enabled  <==
WBMP Support  enabled 
XBM Support  enabled 
[/quote]

yet the image is not generated. Next step ? The full info can be viewed here http://www.fastrax.be/chevron/imggen/test.php
Link to comment
Share on other sites

I hope the instructions in the download were perfect  ;D

Sounds like a difference between the way you have things set/named and how my script requires them.  It's supposed to work 'out of the box' when everything is uploaded into the same relative structure as the zip file without changes.
Link to comment
Share on other sites

instructions were clear, didnt modify anything yet. That's exactly the problem. GD is version 2.0.28 as in the quote so it should work. Can it be it has problems with dynamic generated images ? Ifso, can it be set to use static jpg's ?
Link to comment
Share on other sites

update, i found the bug (with help of my provider). In the captcha_image.php the config file gets called from the dir captchas/captcha_config.php , but while unzipping it gets extracted into the main dir. So it was just a way of moving the file or removing the captcha/ part in the config file on line 3. 2 last questions. 1) As extra security i would like to ad the small letters too. Currently it only uses CAPS & numbers, but when i add the lowerercase letters too i get securitycode mismatch. Can i do this or should i leave it ?

2) Is it possible to have a rotating background (this is optional) ?
Link to comment
Share on other sites

i wrote my own script to enable the background images to fit with the style of the site (sad...i know)

I can let you have the full scirpt if you want.  It is rather simple but in princple it does this.

Sets a background image from a folder.
Opens a fonts folder
Selects a random font
selects a random number from 0-9
repeats this to get a series of 5 numbers in random fonts (and x,y co-ords)
Then generates a complete image with session variable.

Let me know if this would be of use
Link to comment
Share on other sites

Thanks for the update. I've fixed the mis-location in the zip!!

The script 'as is' intentionally omitted some characters that might be confused (0 and O, 1 and I) and upper-case seemed like enough variability. In case people 'forgot' to enter the security code in upper-case, the script changed all input to upper-case before testing with this line:

[code]$secure = strtoupper(trim(strip_tags($_POST['secure'])));[/code]

If you want to add lower case letters to those available, you can ... as long as you change that line above here to this:

[code]$secure = trim(strip_tags($_POST['secure']));// leave case as entered[/code]
Link to comment
Share on other sites

any chance on rotating bg's either ? but thats just as an extra

update. Lowercase : worked like a charm mate. Thx for the script. Maybe ill give ya some credit on my website once the changes go live ;)
Link to comment
Share on other sites

Remember that the script as written chooses a random section of the background to use as the captcha. 

If you want a randomly chosen background, then edit the captcha_config.php file to replace this line:

[code]$background = "captchas/random-back-image4.jpg"; // this is the image used for random background creation[/code]

With these lines:

[code]$backs = array("random-back-image4.jpg", "another-image.jpg", "different-image1.jpg"); // as many as you want as long as they all exist!!
$background = "captchas/". $backs[rand(0,count($backs)-1)];// a random background[/code]

Obviously the differently named background have to exist and be in the same folder as the original background image. You can add as many as you want to the $backs array. It's untested but highly likely to work. If it does, you owe me a beer  ;D
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.