Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $url = '/var/www/ivt/nht_ips_current.gz';
- function uncompress($srcName) {
- $filesize=filesize('/var/www/ivt/nht_ips_current.gz');
- $newline = "\n";
- $i=0;
- $sfp = gzopen($srcName, "rb");
- while (!gzeof($sfp)) {
- $line = gzgets($sfp, 128);
- $data = explode("\t", $line);
- $i++;
- $long = ip2long($data[0]);
- $sql[]='('.$long.')';
- if($i==10000)
- {
- mysql_query('INSERT INTO alltheips VALUES '.implode(',', $sql));
- $i=0;
- unset($sql); // $foo is gone
- $sql = array();
- }
- }
- gzclose($sfp);
- }
- uncompress($url);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement