您现在的位置是:首页 > cms教程 > ecshop商城教程ecshop商城教程
ecshop商城IP库版本升级补丁
傅利2024-04-20 18:16:52ecshop商城教程已有17人查阅
导读ECSHOP官方更新了多个版本,但IP库一直没更新,版本为20071024,相当鸡肋,本升级程序读取纯真IP数据库,独有高压缩比和快速检索算法。
ECSHOP官方更新了多个版本,但IP库一直没更新,版本为20071024,相当鸡肋,本升级程序读取纯真IP数据库,独有高压缩比和快速检索算法。
新版纯真IP库
升级指南
一、下载纯真IP数据库,地址一:本站下载,下载后请重命名为ipdata.dat,覆盖至/includes/codetable/。
二、编辑/includes/lib_base.php,将函数ecs_geoip($ip)替换为
* 获取IP对应的地理位置 * @paramstring
$ip
字符串 * @return string */ function ecs_geoip($ip) { $return = ''; if(preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/", $ip)) { $iparray = explode('.', $ip); if($iparray[0] == 10 || $iparray[0] == 127 || ($iparray[0] == 192 && $iparray[1] == 168) || ($iparray[0] == 172 && ($iparray[1] >= 16 && $iparray[1] <= 31))) { $return = 'LAN'; } elseif($iparray[0] > 255 || $iparray[1] > 255 || $iparray[2] > 255 || $iparray[3] > 255) { $return = 'Invalid IP Address'; } else { $tinyipfile = ROOT_PATH . 'includes/codetable/ipdata.dat'; //ipdata.dat-纯真网络IP库 if(@file_exists($tinyipfile)) { $return = convertip_tiny($ip, $tinyipfile); } } } return $return; } function convertip_tiny($ip, $ipdatafile) { static $fp = NULL, $offset = array(), $index = NULL; $ipdot = explode('.', $ip); $ip = pack('N', ip2long($ip)); $ipdot[0] = (int)$ipdot[0]; $ipdot[1] = (int)$ipdot[1]; if($fp === NULL && $fp = @fopen($ipdatafile, 'rb')) { $offset = @unpack('Nlen', @fread($fp, 4)); $index = @fread($fp, $offset['len'] - 4); } elseif($fp == FALSE) { return 'Invalid IP data file'; } $length = $offset['len'] - 1028; $start = @unpack('Vlen', $index[$ipdot[0] * 4] . $index[$ipdot[0] * 4 + 1] . $index[$ipdot[0] * 4 + 2] . $index[$ipdot[0] * 4 + 3]); for ($start = $start['len'] * 8 + 1024; $start < $length; $start += 8) { if ($index{$start} . $index{$start + 1} . $index{$start + 2} . $index{$start + 3} >= $ip) { $index_offset = @unpack('Vlen', $index{$start + 4} . $index{$start + 5} . $index{$start + 6} . "\x0"); $index_length = @unpack('Clen', $index{$start + 7}); break; } } @fseek($fp, $offset['len'] + $index_offset['len'] - 1024); if($index_length['len']) { return @fread($fp, $index_length['len']); } else { return 'Unknown'; } }
本文标签:
很赞哦! (0)
暂无内容 |
暂无内容 |
相关文章
暂无内容 |
暂无内容 |
随机图文
ecshop首页商品怎么实现随机排序
首页ecshop商品随机排序的三种方法都是修改inlcudes/lib_goods.php这个文件1 精品推荐 新品上架 热卖商品 促销商品 团购商品 拍卖商品 6类随机排序的调整方法Linux下搭建ecshop的步骤方法
打开虚拟机,选择自己的虚拟机,右键设置检查下列勾选框是否勾选上创建文件夹mkdir /mnt/cdrom加载LINUX安装光盘mount /dev/cdrom /mnt/cdrom进入安装程序目录cd /mnt/cdroecshop浏览历史商品按照点击的先后进行排序的修改方法
在Ecshop中,浏览历史目前默认的显示顺序是按照商品的ID排序的~~~怎么样能让它按照浏览的先后进行排序呢?ecshop安装提示cls_image::gd_version()和不支持JPEG的解决方法
在安装Ecshop的时候,遇到两个问题: 1.Strict Standards: Non-static method cls_image::gd_version() should not be called statically in D:\X\ \ecshop\install\inclu
留言与评论 (共有 0 条评论) |