您的位置:首页 > 其它

【旧版2016.4.17前】东北大学校园网一键登陆ajax版

2016-04-18 19:15 323 查看
这个版本是写的比较简单的,可以通过一键登陆校园网,免去多次页面跳转的操作和密码的输入方式。实质是模拟断开网络和重新连接两次操作,可能存在http错误(这个暂时没有考虑)。

优点:

帐密直接嵌入到html中即可;

通过ajax免去页面的跳转,最终实现一个页面直接完成所有操作;

ps:虽然不是什么很牛的方法,室友不愿意尝试新东西好可惜。

<head>
<meta charset="utf-8">
</head>
<body>
<script>
var XMLHttpReq;
function createXMLHttpRequest() {
try {
XMLHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(E) {
try {
XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(E) {
XMLHttpReq = new XMLHttpRequest();
}
}

}
function sendAjaxRequest(url) {
createXMLHttpRequest();
XMLHttpReq.open("post", url, true);
XMLHttpReq.send(null);
}
window.onload = function(){
url = "http://ipgw.neu.edu.cn/ipgw/ipgw.ipgw?uid=stu_xxxxxxxx&password=xxxxx&operation=disconnectall&range=2&timeout=1";  
sendAjaxRequest(url);
url = "http://ipgw.neu.edu.cn/ipgw/ipgw.ipgw?uid=stu_xxxxxxxx&password=xxxxx&operation=connect&range=2&timeout=1";
sendAjaxRequest(url);
window.close();
}
</script>
</body>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: