public static function zsetAddAndReturn(Predis_Client $client, $keyName, array $values, $wipeOut = 0) { // $values: array(SCORE => VALUE, ...); if ($wipeOut == true) { $client->del($keyName); } foreach ($values as $value => $score) { $client->zadd($keyName, $score, $value); } return $values; }
include mnminclude . 'external_post.php'; include_once mnminclude . 'log.php'; include_once mnminclude . 'ban.php'; include_once mnminclude . '/predis/Predis.php'; include_once mnminclude . '/predis/Predis_Compatibility.php'; $redis = new Predis_Client(); $TYPE = 2; $file = "IpToCountry.csv"; echo "<pre>"; $f = fopen($file, "r"); $iptable = array(); $k = 0; while ($csv = fgetcsv($f, 255)) { if ($csv[0][0] != '#') { print_r($csv[0] . $csv[6] . "/n"); $redis->zadd($globals['enviroment'] . 'ips', $csv[0], $csv[6] . '-' . $k); $k++; } else { } } fclose($f); die; print_r($iptable[0]); print_r($iptable[1]); print_r($iptable[2]); switch ($TYPE) { case 1: /* * Fill ip_countries table */ foreach ($iptable as &$val) {