Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Dwayne Rothe  >  IP2Country PHP  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: IP2Country PHP
Get information of the country of an IP address
Author: By
Last change:
Date: 2010-11-21 14:38
Size: 1,618 bytes
 

Contents

Class file image Download
<?PHP
// example of basic use

// set directory path to where the ip2countryphp.sql.php file is
// this MUST be a relative path and MUST include the end slash /
define("BASEDIR","./");

// set width of flag, height is proportional to width.
$flag_width "30"

// include the class file
include(BASEDIR."ip2countryphp.sql.php");

/* 
Below is a heredoc example of how you might display the users info,
of course you can include only the variables you want to, or you might 
want to store the ip address, 2 letter country code(for flag image) and
country name in a database for using on a specific page.
*/

print <<<TEST
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ip2country PHP - (MySQL)</title>
</head>
<body style="font:normal 9pt tahoma,arial,verdana">
<table style="margin-top:20px;border:#CCCCCC 1px solid" width="280" cellspacing="2" cellpadding="3" border="0" align="center">
  <tr><td bgcolor="#CCCCCC" colspan="2">&nbsp;<font color="white">ip2country PHP - (MySQL)</font></td></tr>
  <tr><td width="120" height="26">IP Address:</td><td>
$ip_address</td></tr>
  <tr><td>Country name:</td><td>
$country_name</td></tr>
  <tr><td>2 letter code:</td><td>
$two_letter_code</td></tr>
  <tr><td>3 letter code:</td><td>
$three_letter_code</td></tr>
  <tr><td>Country flag:</td><td><img src="
$flag_img" width="$flag_width" border="0"></td></tr>
  <tr><td bgcolor="#CCCCCC" colspan="2"><font color="white" size="1">www.ip2countryphp.freei.me</font></td></tr>
</table>
</body>
</html>
TEST;
exit;
?>