365建站器v12隆重发布,全新的界面,全新的体验,全新的功能,您值得佣有! 365建站器v12隆重发布! 立即查看

365建站广告管理中通过指定ip地区或ip段跳转指定页面的方法

发表在 新手指南/使用教程 2022-4-25 22:35:30 上一主题 下一主题 0 1850

365建站广告管理中通过指定ip地区或ip段跳转指定页面的方法:
1、需要源码是20220330之后版本的源码

2、在广告设置中设置代码
  1. <style>html,body{width:100%;height:100%;overflow:hidden;margin:0;padding:0;}</style>
  2. <iframe src="/plugins/iptourl.php" width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0"  scrolling="yes" style="position: absolute;z-index:99999;left:0;top: 0px;background:#FFF;"></iframe>
复制代码

3、在网站目录plugins文件夹下创建一个php文件iptourl.php,名称和上面调用的名称一致,
实例1,通过指定ip地区跳转指定页面的方法,代码如下:
  1. <?php
  2. require_once(dirname(__FILE__)."/../source/core.php");
  3. $ipaddress=getipaddress();
  4. //每行一个
  5. $actlist='
  6. 北京->http://xxxx1.com
  7. 上海->http://xxxx2.com
  8. 其它->http://baidu.com
  9. ';
  10. $actlistarr=explode(PHP_EOL,$actlist);
  11. foreach($actlistarr as $value){
  12.         if(empty($value)) continue;
  13.         $valuearr=explode("->",$value);
  14.         if(strstr($ipaddress,$valuearr[0])){
  15.                 header('Location:'.$valuearr[1]);
  16.                 exit;
  17.         }
  18.         if(!strstr($ipaddress,$valuearr[0])&&$valuearr[0]=='其它'){
  19.                 header('Location:'.$valuearr[1]);
  20.                 exit;
  21.         }
  22. }
  23. exit;
  24. ?>
复制代码


实例2,通过指定ip段跳转指定页面的方法,代码如下:
  1. <?php
  2. require_once(dirname(__FILE__)."/../source/core.php");
  3. $userip = GetIP();
  4. //每行一个
  5. $actlist='
  6. 192.168.33->http://xxxx1.com
  7. 888.777.666->http://xxxx2.com
  8. 其它->http://baidu.com
  9. ';
  10. $actlistarr=explode(PHP_EOL,$actlist);
  11. foreach($actlistarr as $value){
  12.         if(empty($value)) continue;
  13.         $valuearr=explode("->",$value);
  14.         if(strstr($ipaddress,$valuearr[0])){
  15.                 header('Location:'.$valuearr[1]);
  16.                 exit;
  17.         }
  18.         if(!strstr($userip ,$valuearr[0])&&$valuearr[0]=='其它'){
  19.                 header('Location:'.$valuearr[1]);
  20.                 exit;
  21.         }
  22. }
  23. exit;
  24. ?>
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则