PHP Classes

File: get_by_ip.example.php

Recommend this page to a friend!
  Classes of Kaurov Eugene   GET by IP   get_by_ip.example.php   Download  
File: get_by_ip.example.php
Role: Example script
Content type: text/plain
Description: php+oracle example to use get_bi_ip class
Class: GET by IP
Get the country of a IP querying a whois server
Author: By
Last change:
Date: 19 years ago
Size: 1,287 bytes
 

Contents

Class file image Download
<?
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);
       
    }
?>