|
RT,十几年前注册的免费虚拟主机,至今还活着,有两个限制:
1.数据库phpmyadmin要JP IP访问
2.网页顶部会添加广告
IP的问题打代理能解决,现在想知道如何去广告,先说说广告是怎么添加的:
1.网页加载时会自动下载一个xrea_header.js
JS内容:
- (function(){
- //add css
- // var newStyle = document.createElement("link");
- // newStyle.href = 'https://cache1.value-domain.com/xrea_header.css?5';
- // newStyle.type = 'text/css';
- // newStyle.rel = 'stylesheet';
- // document.getElementsByTagName('head')[0].insertBefore(newStyle, null);
- var func = function(){
- // var body = document.body;
- // if (body == undefined) {return false;}
- var parent = document.getElementsByTagName("body")[0];
- if (parent === null) {return false;}
- //console.log(body,parent);
- var elements = [
- '<a href="https://www.value-domain.com/guide/setregist/?adref=xrea_ad&utm_source=xrea&utm_medium=banner&utm_campaign=xrea_ad" target="_blank" rel="nofollow" style="display:inline-block!important;position:relative!important;top:0!important;left:0!important;margin:0!important;padding:0!important;"><img src="https://www.value-domain.com/assets/img/guide/setregist/bnr_xrea.png" alt="コアサーバーV2プランご契約でドメイン更新費用が永久無料" style="display:inline-block!important;position:relative!important;top:0!important;left:0!important;margin:0!important;padding:0!important;width:100%!important;max-width:468px;max-height:60px;vertical-align:bottom;"></a>'
- ];
- var randElm = elements[Math.floor(Math.random() * elements.length)];
- var newBox = document.createElement("div");
- newBox.setAttribute('id', 'vdbanner');
- newBox.setAttribute("style","display:block!important;position:relative!important;top:0!important;left:0!important;margin:10px 0 !important;padding:0!important;text-align:center!important;");
- newBox.innerHTML = randElm;
- parent.insertBefore(newBox, parent.firstChild);
- };
- try {
- window.addEventListener("load", func, false);
- }
- catch(e) {
- window.attachEvent("onload", func);
- }
- })();
复制代码 2.执行JS后会向网页<body>里添加广告,div id是vdbanner
根据网上查到的资料,在header.php里添加<!--nonanner-->可以直接禁止广告(好像说是去广告的官方方法),不过官方明确说明了隐藏广告会被停用,所以需要变通,尝试过以下代码,广告能去除,不过是<!--nobanner-->起的作用,跟是否判断无关:
- <?php $language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2);
- if ($language='zh')
- echo '<!--nobanner-->;
- ?>
复制代码 哪个玩PHP HTML的指导一下?
|
|