★精品文档★hta编辑host文件脚本
代码如下:
<html
<head
<titlehosts文件编辑器</title
<meta http-equiv=content-type content=text/html ;charset=gb2312
<meta http-equiv=content-language content=zh-cn
<hta:appl ication id=hosteditappl icationname=hosteditborder=thickborderstyle=normalcaption=yesicon=c:\windows\system32\rasphone.exe maximizebutton=yesminimizebutton=yesshowintaskbar=yessingleinstance=yessysmenu=yesversion=1 .0windowstate=normal /
<script language=jscript
1/17
★精品文档★window.onerror=function ()
{
window.alert(程序发生了未知错误当前窗口将被关闭 );
window.close();
return true;
}var windoww=450; //窗体宽var windowh=200; //窗体高var canresize=false;//是否可以改变大小var windoww2=windoww;//编辑时窗体宽var windowh2=200;//编辑时窗体高window.resizeto(windoww,windowh);
//window.moveto((screen.width-windoww)/2,(screen.height-windowh)/2);window.onresize=function(){if(!canresize)window.resizeto(windoww,windowh);}function init()
{
var ui_table =2/17
★精品文档★document.getelementbyid(‘ui_table’);
var bestheight =70+ui_table.scrol lheight;
if(bestheight screen.height)bestheight=screen.height;
window.resizeto(windoww,bestheight);
//window.moveto((screen.width-windoww)/2,(screen.height-bestheight)/2);
}var hostfi le=‘\\drivers\\etc\\hosts’ ;function getl ist(){
var html=‘ ‘ ;
var ids=‘ ‘ ;
var i=1 ;
fso = newactivexobject(scripting.fi lesystemobject);
var spath =fso.getspecia lfolder(1)+hostfi ,3}\s+([a-za-z0-9\-]+\.[a-za-z0-9\-]+(\.(com|net|org|edu| info|biz|cc|tv|gov|mobi |name|cn|en|us|hk|tw))+)$/.test(tmp))
{
3/17
★精品文档★
as=tmp.replace(/\s+/, ’ | : | ’).spl it(‘ | : | ’);
&nb co =‘#eee! important’ ;
cz =‘<a href=# style=color:red; oncl ick=zh(‘+i+’ ,0);切本地</a|<a href=#style=color:red;oncl ick=ed(this, ’+i+’);编辑</a|<a href=#style=color:red;oncl ick=zh(‘+i+’ ,2);删除</a’ ;
}else{
zt= ‘本地’ ;
ip=as[0];
co =‘#fff! important’ ;
cz =‘<a href=#oncl ick=zh(‘+i+’ ,1);切外网</a |<a href=#style=color:red; oncl ick=ed(this, ‘+i+’);编辑</a | <ahref=# style=color:red; oncl ick=zh(‘+i+’ ,2);删除</a’ ;
}
html +=
4/17
★精品文档★
‘<tr<td style=background: ’+co+’ ; ’+zt+’</td<tdstyle=background: ’+co+’ ;text-al ign: left;text-indent:6px; ’+as
[1]+’</td<tdstyle=text-al ign: left;text-indent:6px;background: ’+co+’ ; ’+ip+’</td<td style=background: ’+co+’ ; ’+cz+’</td</tr’ ;
}
i++;
}
var o=document.getelementbyid(‘ ids’);
o.value=ids;
host.close();
return html ;
}function ed(eo, i id){
document.getelementbyid(‘editid’).value=i id;
document.getelementbyid(‘pip’).value=eo.parentelement.parentelement.chi ldren[2]. innertext;
document.getelementbyid(‘purl’).value=eo.parentelement.parentelement.chi ldren[1]. innertext;
5/17
★精品文档★
document.getelementbyid(‘addbutt’).style.display=‘none’ ;
document.getelementbyid(‘editbutt’).style.display=‘ inl ine’ ;
document.getelementbyid(‘hostl ist’).style.display=‘none’ ;
document.getelementbyid(‘addhost’).style.display=‘block’ ;d{1 ,3}\.\d{1 ,3}\.\d{1 ,3}$/.test(oi .value)==false) {
alert(‘ ip地址不能为空或你输入的ip格式错误. ’);
oi .focus();
return;
}
if(ou.valuesp; return;
}
var i id =document.getelementbyid(‘editid’).value;
var body=‘ ‘ ;
var i=1 ;
fso = new
6/17
★精品文档★activexobject(scripting.fi lesystemobject);
var spath =fso.getspecialfolder(1)+hostfi le;
host=fso.opentextfi le(spath, 1 , false);
whi le(!host.atendofstream){
tmp=host.readl ine();
if(i==i id)
{
body+=oi .value+\t+ou.value+\n;
}
else{
body+=tmp+\n;
}
i++;
}
host.close();
&n bsp;&n bsp;svf=fso.opentextfi le(spath,2, false);
svf.write(body);
svf.close();
window. location.reload();
7/17
★精品文档★
}function zh(irs,stype)
{
var body=‘ ‘ ;
var i=1 ;
fso = newactivexobject(scripting.fi lesystemobject);
var spath =fso.getspecialfolder(1)+hostfi le;
host=fso.opentextfi le(spath, 1 , false);
whi le(!host.atendofstream){
tmp=host.readl ine();
body+=tmp+\n;
}else{
body+=‘#’+tmp+\n;
}
}else{
}
}
8/17
★精品文档★
else{
body+=tmp+\n;
}
i++;
}
host.close();
&n bsp;&n bsp;svf=fso.opentextfi le(spath,2, false);
svf.write(body);
svf.close();
window. location.reload();
}function zhal l(stype)
{
var body=‘ ‘ ;
var i=1 ;
varids1=document.getelementbyid(ids).value;
if(ids1==‘ ‘) return;
fso = newactivexobject(scripting.fi lesystemobject);
var spath =
9/17
看到群里网友们在讨论由于不清楚的原因,有同学的网站无法访问。他的网站是没有用HTTPS的,直接访问他的HTTP是无法访问的,通过PING测试可以看到解析地址已经比较乱,应该是所谓的DNS污染。其中有网友提到采用HTTPS加密证书试试。因为HTTP和HTTPS走的不是一个端口,之前有网友这样测试过是可以缓解这样的问题。这样通过将网站绑定设置HTTPS之后,是可以打开的,看来网站的80端口出现问题,而...
这两天在站长群里看到不少有使用DEDECMS织梦程序的朋友比较着急,因为前两天有看到来自DEDECMS,我们熟悉的织梦程序官方发布的公告,将会在10月25日开始全面商业用途的使用DEDECMS内容管理程序的会采用授权收费模式,如果我们有在个人或者企业商业用途的,需要联系且得到授权才可以使用,否则后面会通过维权的方式。对于这个事情,我们可能有些站长经历过,比如字体、图片的版权。以及有一些国内的CMS...
BuyVM商家算是一家比较老牌的海外主机商,公司设立在加拿大,曾经是低价便宜VPS主机的代表,目前为止有提供纽约、拉斯维加斯、卢森堡机房,以及新增加的美国迈阿密机房。如果我们有需要选择BuyVM商家的机器需要注意的是注册信息的时候一定要规范,否则很容易出现欺诈订单,甚至你开通后都有可能被禁止账户,也是这个原因,曾经被很多人吐槽的。这里我们简单的对于BuyVM商家新增加的迈阿密机房进行简单的测评。如...