返回列表 发新帖
查看: 1845|回复: 0

[Discuz!二次开发] Discuz检测内网checkdns

[复制链接]

305

热度

116

元宝

231

贡献

年费ViP

发表于 2016-1-4 19:20:43 | 显示全部楼层 |阅读模式
  1. function checkdns() {
  2.     global $_G;
  3.     if (empty($_G['siteurl'])) {
  4.         return true;
  5.     }
  6.     $xmlf = importfile();
  7.     $xmlt = @implode('', file($xmlf));
  8.     require_once libfile('class/xml');
  9.     $xmld = xml2array($xmlt);
  10.     $deve = preg_match('(' . $_G['siteurl'] . ')', $xmld['From']);
  11.     if ($deve) {
  12.         return false;
  13.     }
  14.     $matc = parse_url($_G['siteurl']);
  15.     $host = !empty($matc['host']) ? $matc['host'] : $_G['clientip'];
  16.     $clip = gethostbyname($host);
  17.     if ($clip == $host) {
  18.         return true;
  19.     } else {
  20.         return preg_match('#^(10|127|172\.16|192\.168)\.#', $clip);
  21.     }
  22. }
复制代码


返回列表 发新帖
 懒得打字嘛,点击右侧快捷回复【最新发布】   【赞助草根吧享更多权益】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

收藏帖子 返回列表 搜索

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

小黑屋|手机版|草根吧