hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Programming Tutorials : [HowTo] Create signature confirmation images [Captcha]
Reply

Programming Tutorials How-Tos related to programming, databases, and the like.
Forum Jump

[HowTo] Create signature confirmation images [Captcha]

Reply Post New Thread In Programming Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 07-19-2006, 06:35 PM
Barti1987 Barti1987 is offline
Web Hosting Master
 
Join Date: Mar 2004
Location: USA
Posts: 4,342
Lightbulb

[HowTo] Create signature confirmation images [Captcha]


This is my first topic here. I hope some might find of interest and maybe usefulness..

On one of my sites, I started getting a lot of spam (Med's type website) through my forums.

I then started to think why not add image captcha, which is explained on wikipedia: en.wikipedia.org/wiki/Captcha

I looked for sources and most scripts I found dealt with database storing of info, which I don't want to increase the already high load on my mysql engine.

I then rewrote the script to work without database, simply by passing the variable via POST encoded, thus staying with purpose.

Requirements for this script:
+++++++++++++++++++++

* Working GD Library + ImageTTFText.

Files we are going to use:
+++++++++++++++++++++

1) show_image.php -> Which will display an image of a text it receives via HTTP_GET after decoding it
2) contact_me.php -> the normal form you want to use the image with (demo)
3) functions.php -> has two functions we are going to use, if you change this filename, change the includes on both contact.php/show_image.php

Working the script:
+++++++++++++++++++++

1) On your HTML form (contact_me.php in this example) add:
- First we will generate a encoded code, lets say hid_num:
--a hidden input called hide_num,that has the value of hid_num
--an img src which has the value for show_image.php?code=hid_num

2) We will send this code to show_image.php via HTTP and then decode it in show_image.php and display it as an image. This requires the use of a font, in our case our font name is "COOPBLA.TTF" -> Insure legalities before using the font, can be changes on show_image.php settings.

3) When we submit the forum we will decode POST hid_num and compare it with what the user entered, if ok pass, else we will reload the post with a different image and value and error message.

The complete script is attached, use by running contact_me.php.

Any questions feel free to ask.

Download script from: http://www.megaupload.com/?d=IP642DRI

Peace,

Reply With Quote


Sponsored Links
  #2  
Old 07-22-2006, 07:49 AM
JimBob45506 JimBob45506 is offline
Junior Guru Wannabe
 
Join Date: Mar 2006
Location: Springfield, OH
Posts: 32
I just downloaded the files. Nice work! Thanks.

Reply With Quote
  #3  
Old 07-31-2006, 11:24 PM
BostonGuru BostonGuru is offline
Aspiring Evangelist
 
Join Date: Dec 2005
Posts: 394
Great script for those who want to conserve their CPU for necessary SQL queries only.

I am very paranoid about security so I found a way to create a dynamic encryption key which changes each time the page is run.

1. copy the contents of the functions.php into the top of your contact_me.php, then delete the functions.php file.
2. Copy the contents of show_image.php into contact_me.php below the functions.php contents, but above the origional contact_me.php contents. For whatever reason you will get odd header errors if you put it at the bottom.
3. Enclose the show_image.php contents like this:
PHP Code:
if($page=="image")
{
show_image.php contents

4. Place the following just about the if brackets you just created.

PHP Code:
$_GET['page]; 
$microTime = mktime(); 
5. Enclose the origional contact_us.php within else brackets.
6. Located towards the bottom of the origional contact_me.php code change show_image.php?code=$image_link to index.php?page=image&code=$image_link.
7. Last you want to make sure that you removed the lines from the show_image.php and origional contact_me.php contents that calls the function.php file, because that code is now within the same file, and calling the functions.php will only cause problems.

Now you can set your keyfile to something like

PHP Code:
$keyfile md5($microTime.x93kjs8); 
This will cause your encryption key to change each time the page is loaded.

Reply With Quote
Sponsored Links
  #4  
Old 09-06-2006, 04:59 AM
TheAnz TheAnz is offline
Newbie
 
Join Date: Aug 2006
Posts: 9
hello, can have the download link again, that one not valid, if can repidshare link please, thx

Reply With Quote
  #5  
Old 11-14-2006, 04:13 AM
brutetal brutetal is offline
Newbie
 
Join Date: Jun 2006
Location: California
Posts: 5
Could you reupload the file please? I would like to try this out.

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
1&1 Internet Adds New SMB Tools to MyWebsite Web Hosting News 2013-03-25 16:29:43
Selling a Cloud Services Portfolio, with Stephanie Rowan of Parallels Web Hosting News 2013-02-06 15:50:29
50d0b6c9-ba20-4bb3-a086-16e645a79962 Listing 2013-03-05 18:26:05
SoftLayer Launches Flex Images Public Beta for Customers Web Hosting News 2012-02-01 15:10:37
New WHIR TV – Duke Skarda of SoftLayer Discusses New Technologies Blog 2011-09-15 21:20:57


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?