Skip to content

Security Code Verification Using PHP

October 29, 2009

Security code Verification is used for security test to determine whether or not the user is human. Here is a simple security code Verification Script that Generate the code Dynamically.

$im = ImageCreate(120, 30);  //create image
$white = ImageColorAllocate($im, 255, 255, 255);  //Allocate color for  image
$black = ImageColorAllocate($im, 50, 50, 50);
$string = md5(rand(0,9999));  //Generate a random value and Calculate the md5 hash of the string
//echo $string;
$string=substr($string,1,7); //Return part of a string
$verification = $string;
ImageFill($im, 0, 0, $black); //Fill the Image
ImageString($im, 5, 30, 10, $verification, $white); //Draw the string
Imagejpeg($im, “verify.png”); //Create the Image as ‘png’ format
ImageDestroy($im);  //Destroy the image
<form method=”post” action=”image_verification.php”>
<input type=’hidden’ name=’secretcode’ value='<?=$verification?>’>
Type Code from Image:
<input type=’text’ name=’code’>
<img src=’verify.png’ border=’1′>
<input type=’submit’ name=’submit’ value=’Submit’>

$code = $_POST[‘code’];
$secretcode = $_POST[‘secretcode’];

print “<font color=’red’>Verification failed</font>”;
print “<font color=’green’>Verification Success</font>”;

Connecting MySql With Java

June 9, 2009

Download MYSQL and install it. Instructions for installing MySQL can also be found in Chapter 2 of the MySQL Manual at
To use MySQL with JDBC, you also need to install MySQL Connector/Ja JDBC driver that allows programs to access MySQL databases via JDBC. MySQL Connector/J can also be downloaded from
To install MySQL Connector/J:
1. Copy to your hard disk.
2. Open with a file extractor. Extract its      content to the C:\ drive. This will create a directory named
3. Copy the mysql-connector-java-5.1.7-bin.jar. file to the JRE’s lib\ext directory, e.g., C:\Program Files\Java\jdk1.5.0\jre\lib\ext. After doing so, you could run the application

My First WordPress Template

November 29, 2008

Today I develop a wordpress template, which is my first wordpress template. I named this template BlackWhite. You can see this template by  Clicking the screenshot below.


Please don’t forget to comment.

Earn Money Using

October 20, 2008

I am inviting you to join It’s an alternative to PayPal. There’s no harm in using two services/companies in transacting money. There are a lot of opportunities on both method that’s why I registered myself to both of them.

Advantages of AlertPay are:

1.) You can earn from referring someone to them. It’s easy to start earning. Here’s how:

Step 1: Login to your AlertPay account
Step 2: Click on the “Referral Program” Tab
Step 3: Select your personalized referral link that you can use in your emails, website, banners and so on.
Step 4: Each time someone you refer makes AlertPay their way to pay, they will pay you $5.00. When you refer more then 10 qualified friends, they will pay you $10 for each referral.
Step 5: Your referral bonus will be paid to your account 10 days after successful qualifications.

2.) There’s a new way of earning money popping out in the Internet that pays solely in AlertPay.

The later makes it more interesting to sign-in. In my next post (possibly tommorrow), I will reveal to you how to make extra dollars everyday with AlertPay.

Router Configuration in CLI mode(CISCO)

September 8, 2008
//First sub_netting the IP address & Enter into “configuration mode”:

Router >enable

Router #configure terminal

//Enter configuration commands, one per line.  End with CNTL/Z.

Router (config)#

//configure the ip address for firstEnthernet  0/0 port:

Router(config)#interface fastEthernet 0/0

Router(config-if)#ip address //ip address and subnet mask

Router(config-if)#no shutdown


//configure the ip address of the serial port 0/0/0 port:

Router(config)#interface serial 0/0/0

Router(config-if)#ip address //ip address and subnet mask

Router(config-if)#clock rate 64000

Router(config-if)#no shutdown

//now keep the router passward protecteed:
//To change hostname

Router(config)#hostname R1-ISP

R1-ISP (config)#enable password cisco

R1-ISP (config)#line console 0

R1-ISP (config-line)#password cisco

R1-ISP (config-line)#login

R1-ISP (config-line)#exit

// now enable the Telnet service:

R1-ISP (config)#line vty 0 4

R1-ISP (config-line)#password class

R1-ISP (config-line)#login

R1-ISP (config-line)#exit

My 5th Semester Project

July 21, 2008

My Project advisor Md. Boshir Ahmed (Assistant Professor, Dept. of CSE ) advice me to develop our rental library’s website. Then I start my work and finaly I complete this project. I have developed this Site using HTML, PHP, Mysql and Java Script.

Here is the Link:

Login Script

May 14, 2008

//Create Table

CREATE TABLE `login` (
`username` varchar(16) NOT NULL,
`password` varchar(100) NOT NULL,
PRIMARY KEY (`username`)

INSERT INTO `login` VALUES (‘alamin’, md5(‘053038’)),
INSERT INTO `login` VALUES (‘pollob’, md5(‘053031′));

<table border=’1’>
<form method=”POST” action=”authenticate.php”>
<tr><td colspan=”2″ align=”center”>Log In</td></tr>
<td><input type=”text” name=”username” size=”15″></td>
<td><input type=”password” name=”password” size=”15″></td>
<td colspan=”2″ align=”center”>
<input type=”submit” value=”submit” name=”submit”>


mysql_connect(“localhost”, “root”) or die (“Couldn’t Connect to the server”);
mysql_select_db(“db_name”) or die (“Couldn’t Connect to database”);

// Define username and password
$crypt_pwd = md5($password);

$sql=”SELECT * FROM login WHERE username=’$username’ and password=’$crypt_pwd'”;


$_SESSION[‘username’] = $username;

print “<center>”;
print “<font face=’Arial’ size=’4′ color=’red’>logged in successfully.”;
print “Redirecting ….. <META HTTP-EQUIV = ‘Refresh’ Content = ‘2; URL=sucess.php’>”;
print “</font></center>”;
else {
print “<center>”;
print “<font face=’Arial’ size=’4′ color=’red’>Wrong username or password, redirecting back to login page…..
<META HTTP-EQUIV = ‘Refresh’ Content = ‘2; URL =login.php’></font></center>”;


$get = $_SESSION[‘username’];
print “<center>”;
print “<font face=’Arial’ size=’4′ color=’red’>Welcome $get</font>”;
print “</center>”;

Comment BOX

May 14, 2008

//Create Table

CREATE TABLE `comments` (
`id` int(11) auto_increment,
`name` varchar(30) NOT NULL,
`email` varchar(30) NOT NULL,
`comment` varchar(200) NOT NULL,
`date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,


$coment = add_to_database();
print “Eror: Databases Error”;

//show get data to browser
mysql_connect(“localhost”,”root”) or die(“Could not Connect”);
mysql_select_db(“cse_rental”) or die(“Could not Select Datadase”);

$result = mysql_query(“SELECT * FROM comments”);
$count = mysql_num_rows($result);
print “There R Currently $count Comments”;
while($q = mysql_fetch_array($result)){
<style type=”text/css”>
* {
font-family:Verdana, Sans-serif;
color; #000000;
font-size: 12px
color : #000000;
font: normal 12px;
border-collapse: collapse; border: 1px solid #000000;
<table width=”50%”>
<td rowspan=’3′ valign=’top’ width=”1%”>
<?php echo $q[id]; ?>.
<td bgcolor=”#009966″>Comments:</td>
<tr><td bgcolor=”#FFFFCC”>
<?php echo $q[comment]; ?>
<tr><td bgcolor=”#CCCCCC”>This Comment is posted by <b><?php echo $q[name]; ?></b> on <?php echo $q[date]; ?></td></tr>


<!– Input from user –>
<form action=”comment.php” method=”post” enctype=”multipart/form-data”>
<input type=”hidden” name=”posted”>
<b>Add Your Comments</b><br />
Name:<br />
<input type=”text” name=”name” maxlength=”30″ size=”32″><br />
Email:<br />
<input type=”text” name=”email” maxlength=”30″ size=”32″><br />
Comments:<br />
<textarea cols=”40″ rows=”6″ name=”comment”></textarea><br />

<input type=”submit” value=”Add Comments”><input type=”reset” value=”Reset”>

//add to database
function add_to_database()
$name = trim($_POST[‘name’]);
$email = trim($_POST[’email’]);
$comment = trim($_POST[‘comment’]);

mysql_connect(“localhost”,”root”) or die(“Could not Connect”);
mysql_select_db(“cse_rental”) or die(“Could not Select Datadase”);

$sql = “INSERT INTO comments (`id`,`name`,`email`,`comment`)
return true;