Location: PHPKode > scripts > GET by IP > get-by-ip/get_by_ip.example.php
<?
if (is_file('./dbaccess.php'))	{$pristavka="./";} elseif (is_file('./settings/dbaccess.php')) {$pristavka="./settings/";}
include_once ($pristavka."inc.php");
include_once ($pristavka."dbaccess.php");

$today = getdate();
$click_today=ociparse($db,"SELECT sum(NCLICKS) as NCLICKS FROM VA_WW_COUNTER WHERE ipAddr='".$_SERVER['REMOTE_ADDR']."' and day='$today[mday]' and month='$today[mon]' and YEAR='$today[year]'");
OCIExecute($click_today);
ocifetch($click_today);
$click_today=@ociresult($click_today,"NCLICKS");

if ($click_today>0)
{

	$stmt = ociparse($db,"UPDATE WW_COUNTER SET NCLICKS=NCLICKS+1 WHERE ipAddr='".$_SERVER['REMOTE_ADDR']."' and dtMake=trunc(sysdate)");
	ociexecute($stmt);
		
}
else
	{	
	
		include_once ($pristavka."get_by_ip.class.php");
		$ipdata=new get_by_ip($_SERVER['REMOTE_ADDR']);
		/*echo $ipdata->host."<br>";
		echo $ipdata->netname."<br>";
		echo $ipdata->country."<br>";
		echo $ipdata->person."<br>";
		echo $ipdata->address."<br>";
		echo $ipdata->phone."<br>";
		echo $ipdata->email."<br>";*/
		$stmt = ociparse($db,"INSERT INTO WW_COUNTER (Mainkey, dtMake, ipAddr, domain, countrycode, nClicks) Values (SEQ_WW_COUNTER.nextVal, trunc(sysdate), '".$ipdata->ip."', '".$ipdata->host."', '".$ipdata->country."', '1')");
		ociexecute($stmt);
		
	}
?>
Return current item: GET by IP