<html> <title>CSDN积分查询--清洁工2008版</title> <head> <hta:application id="sofa" icon="sofa.ico" /> </head> <body> <div> 用户名:<input type="text" id="TextUsername" /> 密码:<input type="password" id="TextPassword" /> 目标用户:<input type="text" id="TextDestuser" /> <input type="button" value="开始查询" onclick="ButtonStartClick();" id="ButtonStart" /> </div> <div style="width:100%; height:80%"> <textarea id="TextareaLog" style="width:100%; height:100%"></textarea> </div> <script language="javascript" type="text/javascript"> var ForAppending = 8; // 追加模式 var ForReading = 1; // 读取模式 var ForWriting = 2; // 写入模式 var fso = new ActiveXObject("Scripting.FileSystemObject"); // 文件系统 var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // http访问 var textareaLog = document.getElementById("TextareaLog"); // 日志文本框 var textUsername = document.getElementById("TextUsername"); // 用户名 var textPassword = document.getElementById("TextPassword"); // 密码 var textDestuser = document.getElementById("TextDestuser"); // 目标用户 /// <summary> /// 将字符串追加到文本文件最后 /// </summary> /// <param name="filename">文件名</param> /// <param name="text">所要追加的字符串</param> /// <returns>返回文本文件中的字符串</returns> function AppendFileText(filename, text) { var istream = fso.OpenTextFile(filename, ForAppending, true); if (!istream) return; try { istream.write(text); istream.Close(); } catch (e) { } } /// <summary> /// 添加日志 /// </summary> /// <param name="text">日志文本</param> function AppendLog(text) { if (textareaLog) textareaLog.value += text; AppendFileText("log.txt", text); } /// <summary> /// 获得用户积分信息 /// </summary> /// <param name="username">用户名</param> /// <param name="password">密码</param> /// <param name="destuser">目标用户</param> /// <returns>返回构造的用户积分信息</returns> function GetUserProfile(username, password, destuser) { var contentText = '<?xml version="1.0" encoding="utf-8"?>/n' + '<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">/n' + ' <soap12:Body>/n' + ' <GetUserProfile xmlns="http://www.csdn.net/">/n' + ' <identity>/n' + ' <username>' + username + '</username>/n' + ' <password>' + password + '</password>/n' + ' </identity>/n' + ' <username>' + destuser + '</username>/n' + ' </GetUserProfile>/n' + ' </soap12:Body>/n' + '</soap12:Envelope>/n'; try { xmlhttp.open("post", "http://forum.csdn.net/OpenApi/forumapi.asmx", false); xmlhttp.setRequestHeader("CONTENT-LENGTH", contentText.length); xmlhttp.setRequestHeader("CONTENT-TYPE", "text/xml; charset=utf-8"); xmlhttp.send(contentText); return xmlhttp.responseText; } catch (e) { return ""; } } /// <summary> /// 分析用户积分信息 /// </summary> /// <param name="profileText">用户的XML信息</param> /// <returns>返回构造的用户积分信息</returns> function UserProfile(profileText) { profileText = profileText.replace(//r/n/g, " "); var re = //<errId/>(.*?)/<//errId/>/g; if (re.exec(profileText)) this.errId = RegExp.$1; // 错误号 var re = //<errInfo/>(.*?)/<//errInfo/>/g; if (re.exec(profileText)) this.errInfo = RegExp.$1; // 错误信息 var re = //<point/>(.*?)/<//point/>/g; if (re.exec(profileText)) this.point = RegExp.$1; // 可用分 var re = //<nickName/>(.*?)/<//nickName/>/g; if (re.exec(profileText)) this.nickName = RegExp.$1; // 昵称 var re = //<username/>(.*?)<//username/>/g; if (re.exec(profileText)) this.username = RegExp.$1; // 用户名 var re = //<techExpertPoint/>(.*?)/<//techExpertPoint/>/g; if (re.exec(profileText)) this.techExpertPoint = RegExp.$1; // 专家分 var re = //<nonTechExpertPoint/>(.*?)/<//nonTechExpertPoint/>/g; if (re.exec(profileText)) this.nonTechExpertPoint = RegExp.$1; // 水分 } /// <summary> /// 开始按钮点击事件 /// </summary> function ButtonStartClick() { var userProfile = new UserProfile( GetUserProfile(textUsername.value, textPassword.value, textDestuser.value)); if (userProfile.errId == 0) { textareaLog.value += "-------/r/n" + "用户名:" + userProfile.username + "/r/n" + "昵 称:" + userProfile.nickName + "/r/n" + "专家分:" + userProfile.techExpertPoint + "/r/n" + "水 分:" + userProfile.nonTechExpertPoint + "/r/n" + "可用分:" + userProfile.point + "/r/n"; } else AppendLog("错误:#" + userProfile.errId + "原因:" + this.errInfo + "/r/n"); } </script> </body> </html>使用方法: 1、将如上html复制到文本文件中,改名为“积分查询.hta”; 2、双击运行; 3、输入自己的id、密码和所要查询的用户id; 4、点击按钮。。。
CSDN积分查询--清洁工2008版
最新推荐文章于 2024-05-24 19:47:11 发布