Location: PHPKode > scripts > Turnkey Script: What is your IP? > what-is-your-ip/index.php
<?php
/**
 * What's your IP?
 * (C) SellTurnkey.com
 */

	include dirname (__FILE__) ."/include/header.php";
	require_once dirname (__FILE__) ."/lib/class.ipAddress.php";
	require_once dirname (__FILE__) ."/lib/class.hostIp.php";
	
		
	$ip = new ipAddress ();
	$ipAddress = $ip->getIPAddress ();
	$hostname = @gethostbyaddr ($ipAddress);
	
	$hostIp = new hostIp ();
	$locations1 = $hostIp->getLocations ($ipAddress);
	$cityInfo = $locations1["City"];
	$countryInfo = $locations1["Country"];
	
	if (!empty ($cityInfo))
		$countryInfo = $cityInfo . ", ". $countryInfo;
	
	$imgFlag = $hostIp->getImgFlag ($ipAddress);
	$browser = $ip->getBrowser ();
	$platform = $ip->getBrowserInfo ("platform");
	
?>
			<div id="contenttext">
				<div style="padding:10px">
					<span class="titletext">What is my IP Address?</span>
					</div>
					<div class="bodytext" style="padding:12px;">
					<h1>Your IP address is <?php echo $ipAddress?></h1>
				</div>
					
				<div class="advanced">
					<table width="90%" cellspacing="5">
					
					<?php
						if (!empty ($hostname))
							echo "<tr valign='top'><td><strong>Hostname</strong></td><td>:</td><td>$hostname</td></tr>";
						if (!empty ($countryInfo))
							echo "<tr valign='top'><td><strong>Location</strong></td><td>:</td><td>$countryInfo</td></tr>";
						if (!empty ($imgFlag))
							echo "<tr valign='top'><td><strong>Flag</strong></td><td>:</td><td><img src='$imgFlag' border='1' height='20'></td></tr>";
						if (!empty ($browser))
							echo "<tr valign='top'><td><strong>Browser</strong></td><td>:</td><td>$browser</td></tr>";
						if (!empty ($platform))
							echo "<tr valign='top'><td><strong>OS</strong></td><td>:</td><td>$platform</td></tr>";
					?>
					
					</table>
				</div>
				
			
			</div>
<?php
	include dirname (__FILE__) ."/include/footer.php"
?>
Return current item: Turnkey Script: What is your IP?