Important alert: (current site time 7/15/2013 11:21:34 AM EDT)
 

winzip icon

Image Verification (updated)

Email
Submitted on: 10/4/2002 2:02:50 PM
By: Dracarys  
Level: Intermediate
User Rating: By 14 Users
Compatibility: PHP 4.0
Views: 49593
author picture
(About the author)
 
     This tutorial will show you how to make an image verification like they use (used?) on Yahoo or they still do on Planet Source Code. It is quite useful in order to prevent users from writing scripts that would do the voting, posting or whatever. Now, whenever a user wants to vote for something, he gets an image with a randomly generated string, that consists of uppercase and lowercase characters and numbers from 0 to 9. He then has to enter the string he sees on the picture and only if the code is correct, he will be allowed to proceed. I hope this code will help you. I admit, i took the idea from a recent post on Planet Source Code. (canŽt remember, who it was) But the method used was too unsecure and relied on posting variables. :)

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
10/4/2002 2:48:13 PMDracarys

Ok, please leave your feedback and comments here! :D
(If this comment was disrespectful, please report it.)

 
10/4/2002 4:39:56 PMCharles Chadwick

Very nice. Extremely simple and easy to understand, and you did a great job commenting the source (which a lot of people on PSC don't bother doing). Keep up the great work, I look forward to seeing more code from you in the future.
(If this comment was disrespectful, please report it.)

 
10/4/2002 5:03:47 PMAlex Graf

@Charles Chadwick:

Hi! Thank you for your comment and valuable vote. I tried to write a mail to you but it said: "Mailbox not available"

Well, i think, commenting is very important. If you look at your code a year later, you will not be able to recognize it without comments or a good structure.

So, again thank you. :D
(If this comment was disrespectful, please report it.)

 
10/4/2002 5:06:33 PMAlex Graf

Bloody switching of names. :D I think
the scripts are not perfect here. :) (Dracarys=Me)
(If this comment was disrespectful, please report it.)

 
10/5/2002 8:16:33 AM

Hello, I read your code, it's very nice and simple, but i think that you should use the cookies instead of the session, cause i have a very bad experience with session and that is it forces the page to reload if you come back to it. Let's say that you put this verification where user has to enter 20 fields of information and he entered a bad verification and submited the form code, so when he comes back to the previous form he'll find al the fields empty!!! i think that this will piss him off. I don't know if you have an idea to handle this situation, if you do please let me know of it. I give you 5 stars
(If this comment was disrespectful, please report it.)

 
10/5/2002 8:26:44 AMAlex Graf

Hello. Well, this is true, of course. But i thought about it a while. First: Not every user accepts cookies. Second: You donŽt have to press reload, as it does this automatically, thus, creating a new code.

But, alright, I will try, if i can do it with cookies AND sessions. So, if the user doesnŽt allow cookies, sessions are used.

IŽll post the code, if iŽm ready. :)
(If this comment was disrespectful, please report it.)

 
10/5/2002 8:28:04 AMAlex Graf

Oh, and thanks for your vote! :D
(If this comment was disrespectful, please report it.)

 
10/6/2002 1:18:52 AMDarryl Porter

I worte the same code last month--you should check out the update version--it doesn't use post variables. It was updated one day after it was posted.

And it is very secure now!

imatation is the best form of flattery.
(If this comment was disrespectful, please report it.)

 
10/6/2002 2:50:48 PMAlex Graf

@Darryl Porter: Hi! Thanks for your note. IŽll have a look at it right now. But please believe me, i never intended to write the same code or steal it. :( I only read your code the day you posted it. Then, a week ago, I needed the same code for my HP and remembered, there was only yours, and it used passed variables. So I wrote my own and posted it here too. IŽm sorry, if I did offend you. Again, please believe me, I didnt intend to. Greets, Alex
(If this comment was disrespectful, please report it.)

 
10/7/2002 2:17:19 AMDarryl Porter

Good code. Alot cleaner than mine.
I'm working on a web site right now--and am unable to divide my time--thanks for the offer. If you keep working on it, I'd like to se what you produce.
(If this comment was disrespectful, please report it.)

 
10/7/2002 2:23:59 AMDracarys

@Darryl Porter: Thanks, but same goes for me. But i think, IŽll work on it again at christmas. :)
(If this comment was disrespectful, please report it.)

 
10/27/2002 12:33:09 PMJohn Manavalan

My Dear I cant see any Picture in My Computer.
I am using windows2000
(If this comment was disrespectful, please report it.)

 
10/27/2002 12:36:45 PMJohn Manavalan

plz reply
(If this comment was disrespectful, please report it.)

 
10/27/2002 4:40:53 PMDracarys

@John Manavalan: Well, as i mentioned, you need the GD library with PNG support. In addition your browser need to accept PNGs. So does your webserver. If you disabled PNGs in your server software, you will see nothing. Please check this first.
(If this comment was disrespectful, please report it.)

 
11/22/2002 2:23:47 PM

Hi,
thanks for your codes. But when i use it, the pix isn't display. Just a
(If this comment was disrespectful, please report it.)

 
12/7/2003 9:26:05 AM

Excellent gr8 job. for a fact most novices like me need to know that gd library can be enabled by editing the php.ini and removing the ; before gd2.dll and specifying the correct path for extension..
(If this comment was disrespectful, please report it.)

 
2/28/2004 9:47:23 AMSantium

Great job. 5/5
(If this comment was disrespectful, please report it.)

 
1/27/2005 9:46:15 PM

Line 7 of verificate.php should be

$IMGVER_EnteredText = $_POST[
(If this comment was disrespectful, please report it.)

 
1/27/2005 9:47:45 PM

er, $HTTP_POST_VARS should be $_POST (since the comment was truncated).
(If this comment was disrespectful, please report it.)

 
3/8/2005 2:45:27 AM

hello.. alll

Would you help me..
I've download it code and I copied into my directory.. but why the image can't displayed

it copyed at http://www.embun.net/capcha/

best regards.
setiawan77th
(If this comment was disrespectful, please report it.)

 
3/13/2005 10:10:15 AMJonathan Moseley

@setiawan77th, GD isnt supported.

"Fatal error: Call to undefined function: imagecreate() in /home/sloki/user/t86556/sites/embun.net/www/capcha/doimg.php on line 11"
(If this comment was disrespectful, please report it.)

 
7/27/2005 12:32:11 AMDamian Yerrick

How does this gracefully degrade for users who use a screen reader or a refreshable Braille terminal?
(If this comment was disrespectful, please report it.)

 
8/16/2007 2:41:50 PMShawon Khan

nice work ......
realy 'class A' work.......
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.