Archive for the 'Uncategorized' Category

Draw Plot Graphs with PHP

Googling up for graph plotting solutions in PHP , found these free libraries :
1. PHPLOT – Can create Pie Charts , Bar Graphs , Line Graphs , Point Graphs etc.

Create AutoIncrement column/field in Apache Derby

While creating a table a particular column / field can be made autoincrement as :

CREATE TABLE students
(
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
name VARCHAR(24) NOT NULL,
address VARCHAR(1024),
CONSTRAINT primary_key PRIMARY KEY (id)
) ;

PHP redirect – go back to previous page

To go back to the previous page the superglobal variable $_SERVER can be used.
$_SERVER['HTTP_REFERER'] has the link to the previous page.
So to redirect simply :
#Method to go to previous page
function goback()
{
header("Location: {$_SERVER['HTTP_REFERER']}");
exit;
}

Put flash in webpage – html page

Here is the simple code to put flash animation (swf file) on a webpage.

<object width="550" height="350" data="myalbum.swf" type="application/x-shockwave-flash">
<param name="quality" value="high" />
<param name="id" value="tech" />
<param name="name" value="tech" />
<param name="src" value="myalbum.swf" />
</object>

Draw – Plot graphs with mootools

Plootr is a useful library based on mootools 1.11 which can be used to plot bar graphs , line graphs and pie charts.
It is similar to Plotkit which is based on Mochikit javascript framework.

SYN Flood DOS Attack with C Source Code

TCP/IP 3-way handshake is done to establish a connection between a client and a server. The process is :
1. Client –SYN Packet–> Server
2. Server –SYN/ACK Packet –> Client
3. Client –ACK Packet –> Server

Get Country City from IP address in PHP

Here is a simple php script that lets you track the location of the visitor’s on your site using his IP address.
Code:
<?
$ip = $_SERVER['REMOTE_ADDR'];
$url = "http://www.ipmango.com/api.php?ip=".$ip;
$xml = simplexml_load_file($url);
echo "IP address : {$xml->ipaddress}";
echo "City : {$xml->city}";
echo "Region : {$xml->region}";
echo "Country Name : {$xml->countryname}";
echo "Latitude : {$xml->latitude}";
echo "Longitude : {$xml->longitude}";
?>

BSNL Broadband – Connecting 2 computers to the MT882 ADSL Modem

The Huawei MT882 ADSL Modem that you might have received with your BSNL Broadband connection can be used to connect 2 computers to the internet simultaneously since it is a router. It has a USB interface and an Ethernet interface both of which can be simultaneously used but with a few setting changes.