Solved

Stop Mass Signups? PHP Form Security Checks?

Posted on 2003-10-29
4
325 Views
Last Modified: 2008-02-26
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
0
Comment
Question by:pnh73
  • 2
4 Comments
 
LVL 2

Expert Comment

by:scully00000
ID: 9641289
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
0
 
LVL 1

Author Comment

by:pnh73
ID: 9641749
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).
0
 
LVL 11

Accepted Solution

by:
shmert earned 50 total points
ID: 9643063
Do a google search for "CAPTCHA".  http://www.captcha.net/

Note to scully:  I think a good captcha system will distort the images some, so OCR (Optical Character Recognition) systems can't decipher the image.  One low-tech way to do it would be to create your own alphabet of scrambled images, and then assemble them using <img> tags.  Just don't name the images anything obvious like 's.gif' or something.

Then, display a string of these images which spell out a word, and have the user registering type in the text to authenticate that he is, in fact, human.
0
 
LVL 1

Author Comment

by:pnh73
ID: 9645329
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
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question