Link to home
Start Free TrialLog in
Avatar of pnh73
pnh73

asked on

Stop Mass Signups? PHP Form Security Checks?

Hi,

I was wondering where anyone can advise me how I would go about stopping automated signups for in PHP. I have seen systems where the script generates an image and the user types in the code that can be seen in the image.

I have searched the 'net but cant seem to find anything...

How do I do this?

TIA
Paul
Avatar of scully00000
scully00000

If you are running PHP on Linux:

1. Get Zlib from wherever you get your libraries from (e.g. www.redhat.com). Install it.

2. Get libpng and install it.

3. Get Freetype and install it.

4. Compile the GD library.

5. Recompile PHP with the following options:
--with-gd=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --with-zlib-dir=/usr/local (replace /usr/local with wherever you installed the libraries)

Check PHP works.

Add a function like this:
function randomimg($numstring)

{
$im = ImageCreate (300, 40);
$grey = ImageColorAllocate ($im, 230, 230, 230);
$black = ImageColorAllocate ($im, 0, 0, 0);

ImageTTFText ($im, 20, 0, 10, 25, $black, "arial.ttf", $numstring);

ImagePng ($im);
ImageDestroy ($im);
}

Generate a random number string by your choice of method and pass it to this function.

Cheers
Avatar of pnh73

ASKER

I need a way of doing that doesnt require a linux base or a recompile of PHP as I will probably be serving the site from shared hosting and maybe not even off Linux (much to my dislike, but its the choice of my client).
ASKER CERTIFIED SOLUTION
Avatar of shmert
shmert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pnh73

ASKER

After a little bit more searching with the aid of the post from shmert i found the follwing which looks like it will work :D

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=739&lngWId=8

Thanks

Paul