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.

<?php
$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’>
</form>

<?php
if(isset($_POST[‘submit’]))
{
$code = $_POST[‘code’];
$secretcode = $_POST[‘secretcode’];

if($code!=$secretcode){
print “<font color=’red’>Verification failed</font>”;
}
else{
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 http://dev.mysql.com/doc/mysql/en/index.html.
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 http://www.mysql.com/products/connector/j/.
To install MySQL Connector/J:
1. Copy mysql-connector-java-5.1.7.zip to your hard disk.
2. Open mysql-connector-java-5.1.7.zip with a file extractor. Extract its      content to the C:\ drive. This will create a directory named
mysql-connector-java-5.1.7.
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.

screenshot

Please don’t forget to comment.

Earn Money Using AlertPay.com

October 20, 2008

I am inviting you to join AlertPay.com. 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 172.16.1.254 255.255.255.0 //ip address and subnet mask

Router(config-if)#no shutdown

Router(config-if)#exit

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

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

Router(config-if)#ip address 172.16.3.1 255.255.255.0 //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:
http://pollobcse05.ueuo.com/project1

Login Script

May 14, 2008

//Create Table

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

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

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

//authenticate.php
<?php
ob_start();

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
$username=$_POST[‘username’];
$password=$_POST[‘password’];
$crypt_pwd = md5($password);

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

$count=mysql_num_rows($result);

if($count==1){
session_register(“username”);
session_register(“password”);
$_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>”;
}

ob_end_flush();
?>
//sucess.php

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