Obsah fóra
PravidláRegistrovaťPrihlásenie




Odpovedať na tému [ Príspevkov: 2 ] 
AutorSpráva
Offline

Užívateľ
Užívateľ
Obrázok užívateľa

Registrovaný: 31.07.07
Prihlásený: 09.01.19
Príspevky: 327
Témy: 85
Bydlisko: Humenné
Príspevok NapísalOffline : 07.04.2009 14:04

Ahojte mam dosť zavažny problem mam GEOIP skript a ono mi to v FTP vytvara súbory core s 30 MB veľkosťou a nevytvori ho len 1 ale aj 100-ky mam skript geoip.php , súbor GeoIPCountryWhois.gz kde je zoznam všetkych krajín a IP-čiek a ešte mam súbor geoip.xml zaujimalo by ma prečo mi na hostingu vytvara súbory core

geoip.php

Kód:
<?php

class GeoIP
{
   var $_path;


   /**
   * Boolean found
   *
   * @since 1.0
   * @var boolean
   */
   var $_found         = false;

   /**
   * Starting address of the class
   *
   * @return void
   * @var boolean
   */
   var $_start_ip       = false;

   /**
   * Ending address of the class
   *
   * @return void
   * @var boolean
   */
   var $_end_ip       = false;

   /**
   * Country code
   *
   * @return void
   * @var boolean
   */
   var $_country_code    = false;

   /**
   * Country name
   *
   * @return void
   * @var boolean
   */
   var $_country_name    = false;

   /**
   * CSV values
   *
   * @return void
   * @var boolean
   */
   var $_data         = array();

   /**
   * Long representation of the IP
   *
   * @return void
   * @var boolean
   */
   var $_longip      = 0;

   /**
   * Class constructor
   *
   * @return void
   * @access public
   * @static
   * @since 1.0
   */
   function GeoIP()
   {
      $filename = "GeoIPCountryWhois.gz";
      $this->_data = gzfile($filename);
   }

   /**
   * IP address conversion: A.B.C.D -> log
   *
   * @param string $string IP Address: A.B.C.D
   * @return long
   * @access private
   * @static
   * @since 1.0
   */
    function convert2number($string)
   {
      $pattern= "\"([0-9]+)\"";
      if (ereg($pattern, $string, $regs))
         return (int)$regs[1];
   }

   /**
   * IP searching
   *
   * @param string $beg Starting index
   * @param string $end Ending index
   * @return long/bool
   * @access private
   * @static
   * @since 1.0
   */
    function search($beg, $end)
   {
      /**
      This is the main search functions.

      It uses the DIVIDE-ET-IMPERA paradigm to find the specified IP in the data array.
      Each data in the array looks like:
         "IP_1","IP_2","LONG_IP_1","LONG_IP_2","COUNTRY_CODE","COUNTRY_NAME"

      IP is belonging to COUNTRY_NAME if complies with the formula:
         LONG_IP_1 <= LONG_IP <= LONG_IP_2

      The function returns either:
         - the pozition in the array IF FOUND
         - false, IF NOT FOUND
      */

      $mid = ceil(($end + $beg) / 2);


      $arr_beg = array();
      $arr_mid = array();
      $arr_end = array();

      $arr_beg = explode(",", $this->_data[$beg]);
      $arr_mid = explode(",", $this->_data[$mid]);
      $arr_end = explode(",", $this->_data[$end]);


      $arr_beg[2] = str_replace('"', '', $arr_beg[2]);
      $arr_beg[3] = str_replace('"', '', $arr_beg[3]);

      $arr_mid[2] = str_replace('"', '', $arr_mid[2]);
      $arr_mid[3] = str_replace('"', '', $arr_mid[3]);

      $arr_end[2] = str_replace('"', '', $arr_end[2]);
      $arr_end[3] = str_replace('"', '', $arr_end[3]);




      if (($this->_longip >= $arr_beg[2]) && ($this->_longip <= $arr_beg[3]))
      {
         unset($arr_beg); unset($arr_mid); unset($arr_end);
         return $beg;
      }
      else
         if (($this->_longip >= $arr_mid[2]) && ($this->_longip <= $arr_mid[3]))
         {
            unset($arr_beg); unset($arr_mid); unset($arr_end);
            return $mid;
         }
         else
            if (($this->_longip >= $arr_end[2]) && ($this->_longip <= $arr_end[3]))
            {
               unset($arr_beg); unset($arr_mid); unset($arr_end);
               return $end;

            }
            else
               if (($this->_longip > $arr_beg[3]) && ($this->_longip < $arr_mid[2]))
               {
                  unset($arr_beg); unset($arr_mid); unset($arr_end);
                  return $this->search($beg, $mid);
               }
               else
                  if (($this->_longip > $arr_mid[3]) && ($this->_longip < $arr_end[2]))
                  {
                     unset($arr_beg); unset($arr_mid); unset($arr_end);
                     return $this->search($mid, $end);
                  }
                  else
                  {
                     unset($arr_beg); unset($arr_mid); unset($arr_end);
                     return false;
                  }
   }


   /**
   * IP conversion
   *
   * @param string $address IP address in the A.B.C.D format
   * @return long
   * @access private
   * @static
   * @since 1.0
   */
   function IpAddress2IpNumber($address)
   {
      $pattern = "([0-9]+).([0-9]+).([0-9]+).([0-9]+)";

      if (ereg($pattern, $address, $regs))
         return $number = $regs[1] * 256 * 256 * 256 + $regs[2] * 256 * 256 + $regs[3] * 256 + $regs[4];
      else
         return false;
   }


   /**
   * MAIN SEARCH
   *
   * @param string $ip The IP Searched
   * @return void
   * @access private
   * @static
   * @since 1.0
   */
   function search_ip($ip)
   {
      // if not localhost ...
      if (($ip != "127.0.0.1") && ($ip != "0.0.0.1"))
      {
         $this->_longip = $this->IpAddress2IpNumber($ip);

         if ($this->_longip !== false)
            $poz = $this->search(0, sizeof($this->_data)-1);

         if ($poz !== false)
         {
            $info = explode(",", $this->_data[$poz]);

            $this->_found         = true;
            $this->_start_ip       = str_replace('"', '', $info[0]);
            $this->_end_ip          = str_replace('"', '', $info[1]);
            $this->_country_code    = str_replace('"', '', $info[4]);
            $this->_country_name    = str_replace('"', '', $info[5]);
         }
      }
   }

   /**
   * IP Class start
   *
   * @return string
   * @access public
   * @static
   * @since 1.0
   */
   function getStartIp()      {return $this->_start_ip;}

   /**
   * IP Class end
   *
   * @return string
   * @access public
   * @static
   * @since 1.0
   */
   function getEndIp()         {return $this->_end_ip;}

   /**
   * IP Country Code
   *
   * @return string
   * @access public
   * @static
   * @since 1.0
   */

   function getCountryCode()   {return $this->_country_code;}

   /**
   * IP Country name
   *
   * @return string
   * @access public
   * @static
   * @since 1.0
   */
    function getCountryName()   {return $this->_country_name;}

   /**
   * IP Found flag
   *
   * @return boolean
   * @access public
   * @static
   * @since 1.0
   */
    function found()            {return $this->_found;}


   /**
   * Class unset
   *
   * @return void
   * @access public
   * @static
   * @since 1.0
   */
    function destroy()
   {
      unset($this->_found);
      unset($this->_start_ip);
      unset($this->_end_ip);
      unset($this->_country_code);
      unset($this->_country_name);
      unset($this->_data);
      unset($this);
   }
}


?>


geoip.xml
Kód:
<?xml version="1.0" ?>

<package version="1.0">
   <name>GeoIPWhois Localization</name>
   <summary>This class implements country localization using the IP</summary>
   <description>Using the remote's host IP, this class locates the country usign the CSV WhoisIP file</description>
   <license>LGPL</license>
   <maintainers>
      <user>Marius Zadara</user>
      <role>developer</role>
      <name>Marius Zadara</name>
      <email>marius_victor@yahoo.com</email>
   </maintainers>
   <releaase>
      <version>1.0</version>
      <state>stable</state>
      <date>12th December 2006</date>
      <license>LGPL</license>
      <notes>Final optimized version</notes>
      <filelist>
         <file name="geoip.php" role="php" />
         <file name="GeoIPCountryWhois.csv" role="data" />
      </filelist>
   </release>
</package>


Offline

Užívateľ
Užívateľ
Obrázok užívateľa

Registrovaný: 31.07.07
Prihlásený: 09.01.19
Príspevky: 327
Témy: 85
Bydlisko: Humenné
Príspevok Napísal autor témyOffline : 08.04.2009 13:31

Vyriešenie sťahol som z netu iny skript a upravil podľa svojich predstáv


Odpovedať na tému [ Príspevkov: 2 ] 


Podobné témy

 Témy  Odpovede  Zobrazenia  Posledný príspevok 
V tomto fóre nie sú ďalšie neprečítané témy. M Firefox problém so sťahovaním a GCH problém s updatom

v Sieťové a internetové programy

0

1355

23.01.2015 16:06

Stary Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Problém so zobrazovaním www stránok, problém užívateľa

v Operačné systémy Microsoft

17

2131

23.03.2009 10:41

FERDA23 Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Záhadný problém s PC... problém procesora?

[ Choď na stránku:Choď na stránku: 1, 2 ]

v AMD - Advanced Micro Devices

45

4722

26.04.2012 11:14

netpeter77 Zobrazenie posledných príspevkov

Táto téma je zamknutá, nemôžete posielať nové príspevky alebo odpovedať na staršie. Battlefield 3 SKIDROW problem + win7 problem

v Počítačové hry

1

1573

22.09.2012 23:51

walther Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Problém s MB ASUS P5K - problém s Realtek

v Ovládače

4

2297

14.06.2008 10:36

$ph!nX Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Problém s HDD / Problém s bootovaním

v Pevné disky a radiče

4

1459

22.02.2013 14:08

lucifer666x Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. problem

v Sieťové a internetové programy

0

484

20.01.2009 10:29

qwer0 Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. problem

v Operačné systémy Microsoft

2

531

07.12.2008 18:17

patqo_he Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Problem

v Ostatné

5

649

04.04.2008 15:54

Rapier Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. problem

v ATI/AMD grafické karty

2

590

18.11.2009 20:03

poiuz Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. problem

v Intel čipové sady

2

602

03.03.2022 7:42

vaci Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. PROBLEM

v Ostatné

9

733

14.09.2009 23:07

achmed17 Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. problem

v Antivíry a antispywary

8

731

12.03.2008 8:17

Devil_SK Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. problem..

v Intel čipové sady

4

875

02.03.2008 12:23

Jaro Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. problem !

v Operačné systémy Microsoft

3

595

27.06.2008 13:50

Andres28791 Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. problem

v Audio programy

0

668

26.01.2009 13:09

strna Zobrazenie posledných príspevkov


Nemôžete zakladať nové témy v tomto fóre
Nemôžete odpovedať na témy v tomto fóre
Nemôžete upravovať svoje príspevky v tomto fóre
Nemôžete mazať svoje príspevky v tomto fóre

Skočiť na:  
cron

Powered by phpBB Jarvis © 2005 - 2024 PCforum, webhosting by WebSupport, secured by GeoTrust, edited by JanoF
Ako väčšina webových stránok aj my používame cookies. Zotrvaním na webovej stránke súhlasíte, že ich môžeme používať.
Všeobecné podmienky, spracovanie osobných údajov a pravidlá fóra