Discuz.Forum/IpSearch.cs
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.IO;
using Discuz.Common;
using Discuz.Data;
using Discuz.Config;
namespace Discuz.Forum
{
/// <summary>
/// 判断IP归属地类
/// </summary>
public class IpSearch
{
private static object lockHelper = new object();
static PHCZIP pcz = new PHCZIP();
static string filePath = "";
static bool fileIsExsit = true;
static IpSearch()
{
string ipdatadir = BaseConfigs.GetForumPath + "ipdata";
if (!Directory.Exists(Utils.GetMapPath(ipdatadir)))
{
Utils.CreateDir(Utils.GetMapPath(ipdatadir));
}
filePath = Utils.GetMapPath(ipdatadir + "/ipdata.config");
fileIsExsit = Utils.FileExists(filePath);
if(fileIsExsit)
{
pcz.SetDbFilePath(filePath);
}
}
/// <summary>
/// 返回IP查找结果
/// </summary>
/// <param name="IPValue">要查找的IP地址</param>
/// <returns></returns>
public static string GetAddressWithIP(string IPValue)
{
lock (lockHelper)
{
string result = pcz.GetAddressWithIP(IPValue.Trim());
if (fileIsExsit)
{
if (result.IndexOf("IANA") >= 0)
return "";
else
return result;
}
else
return null;
}
后面还有 302 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
