PHP Image Verification - Eliminating Spam Bot
I was looking for an easier way to alternatively redo MightySpamBlocker a.k.a spam bot eliminator. This article shows a better method in preventing robot login to a web based system. Have this code saved as something like image.php (or whatever name you would love to):
<?php
session_start();
// generate 5 digit random number
$rand = rand(10000, 99999);
// create the hash for the random number and put it in the session
$_SESSION['image_random_value'] = md5($rand);
// create the image
$image = imagecreate(60, 30);
// use white as the background image
$bgColor = imagecolorallocate ($image, 255, 255, 255);
// the text color is black
$textColor = imagecolorallocate ($image, 0, 0, 0);
// write the random number
imagestring ($image, 5, 5, 8, $rand, $textColor);
// send several headers to make sure the image is not cached
// taken directly from the PHP Manual
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
header("Pragma: no-cache");
// send the content type header so the image is displayed properly
header('Content-type: image/jpeg');
// send the image to the browser
imagejpeg($image);
// destroy the image to free up the memory
imagedestroy($image);
?>
Notice this;
$_SESSION[’image_random_value’]
you will need to refer to this session name on the page where the inputs verification is done. The only thing is to start the session on the page;
session_start();
I am considering to do this thing for next release of MightySpamBlocker, depending on how much free time is there.
This is an example on how I use the code for my other blog. It’s a blog submission verification.
Are you lucky?
->
There is a little free commercial within this post since I’ve been lucky yesterday when someone from Exabytes called me up and congratulated me for being the second prize winner for the host-and-win monthly contest. Can’t wait to see the Altec Lancing VS4121 3 pieces speaker…
I’ve been with Exabytes for years and I know […]
Using Images Next to Google Ads - Abuse the Policy?
I wrote an article on how to have random images next to Google before. However I read somewhere on the net that Google now has changed it’s policy about that, but I can’t find where the article is coming from. However thanks Joel Comm for sending me an email about this.
Does Google allow […]
Cari.Net & ResellerZoom.com - Sharing my experience
I started with ResellerZoom somewhere in May 2005 and it has been almost 2 years for me. Nothing much I can say, with a Budget Plan of that small $4.95/month subscription. If you are planning for your own multiple sites with light monthly traffic, then it can be best serving for it, […]
10 Things What Malaysians Are Doing Online
I was trying to figure out what can I do with catfx50 strategy and tring to translate to an EA, but as usual, nothing comes easy. So while looking for more ideas, I came across Alexa ranking and I did checked out on the Top 100 websites visited by Malaysians. So what are we […]
Melayu Boleh: A Paradigm Shift
The term ‘Melayu Boleh’ possibly derived from ‘Malaysia Boleh!’ campaign, a national move towards a strong can-do attitude in every Malaysians mind. However ‘Melayu Boleh’ to most, if not all, Malaysia online community is nothing new linked to a bad image of our nation. For years, a search with the term will return a […]
E-business Malaysian Style!
It’s not a surprise at all to receive bunch of spam emails in my inbox from some online friends, instant messaging pals, forum users etc. That, according to them, is a new way of selling products - by mass emailing their promotional, dicount, new product info etc.
So be it, e-business of their own. Spam. […]
Adbrite on same pages with Adsense?
Some people are debating whether it is allowed to have both Adbrite and Adsense code on the pages on their site. The issue is that Google does not allow any other contextual advertising to be served together with Adsense. However, Adbrite on the other hand has no objection on this, and indeed allows publishers […]
Jutawan Adbrite: Stealing Someone’s Money
Foremostly, I must admit that I’m writing this for an awareness and not to condemn anyone trying to make money out of ‘free’ things like a so-called Jutawan Adbrite.
To understand the whole issue, let me define the parties involved in this scheme - direct or indirectly.
Adbrite (www.adbrite.com):
It is a legal advertisement network started by […]
It’s 2007
Happy new year to all of mightyhitter.com visitors. Wishing you the best with new challenges in 2007. There is one thing that should remain from time to time; it’s the very existance of new ambitions and hopes, yeah. Happy new year, happy new hopes
My wife asked me once just few hours before […]


