private string VerifyLogin(string html) { var verify = string.Empty; var referer = "http://www.zlsoft.com/bbs/forum.php"; var xmlurl = Function.Instance.GetUrl(html); var info = Function.Instance.GetHtml(xmlurl, "gbk", Function.Instance.Cookie); var auth = Function.Instance.GB2312ReCode(Function.Instance.GetAuth(info)); var loginhash = Function.Instance.GetLoginHash(info); var idhash = Function.Instance.GetSeccodeHash(info); var formhash = Function.Instance.GetFormhash(info); var smartverify = string.Empty; var verifysrc = Function.Instance.GetVerifySrc(idhash, ref smartverify); if (Function.Instance.smartverify == true) { verify = smartverify; } else { Verify ify = new Verify(); ify.VerifySrc = verifysrc; ify.SmartVerify = smartverify; ify.ShowDialog(); verify = Function.Instance.verifycode; } var url = "http://www.zlsoft.com/bbs/member.php?mod=logging&action=login&loginsubmit=yes&handlekey=login&loginhash=" + loginhash + "&inajax=1"; var username = Function.Instance.GB2312ReCode(Txt_User.Text.Trim()).Replace("!", "%21"); var password = Function.Instance.UrlReCode(Txt_Pwd.Text.Trim()).Replace("!", "%21"); var postdata = "formhash=" + formhash + "&referer=http%3A%2F%2Fwww.zlsoft.com%2Fbbs%2Fforum.php&auth=" + auth + "&seccodehash=" + idhash + "&seccodemodid=member%3A%3Alogging&seccodeverify=" + verify + "&loginsubmit=true"; var result = Function.Instance.GetHttpWebRequest(url, postdata, referer, ref Function.Instance.Cookie); return result; }
private static string Report(string fid, string tid) { //http://www.zlsoft.com/bbs/forum.php?mod=viewthread&tid=132187 //message=%CA%B2%C3%B4%C7%E9%BF%F6%7E%7E&posttime=1444976844&formhash=e4f6837f&usesig=1&subject=++ var url = "http://www.zlsoft.com/bbs/forum.php?mod=viewthread&tid=" + tid + "&extra="; smarthtml = Function.Instance.GetHtml(url, "gbk", Function.Instance.Cookie); //检查验证码 var verify = Function.Instance.GetSeccodeHash(smarthtml); if (verify == null) { var formhash = Function.Instance.GetFormhash(smarthtml); var message = MsgSwitch(mode); var posttime = Function.Instance.GetTimeStamp(true); var referer = url; var posturl = "http://www.zlsoft.com/bbs/forum.php?mod=post&action=reply&fid=" + fid + "&tid=" + tid + "&extra=&replysubmit=yes&infloat=yes&handlekey=fastpost&inajax=1"; var postdata = "message=" + message + "&posttime=" + posttime + "&formhash=" + formhash + "&usesig=1&subject="; var result = Function.Instance.GetHttpWebRequest(posturl, postdata, referer, Function.Instance.Cookie); if (result.Contains("succeedhandle_fastpost")) { return "回帖:" + tid + " 成功"; } else { hits = false; return "回帖:" + tid + " 失败"; } } else { //获取验证码Src var seccodeverify = string.Empty; var smartverify = string.Empty; var src = Function.Instance.GetVerifySrc(verify, ref smartverify); if (Function.Instance.smartverify == true) { seccodeverify = smartverify; } else { Verify ify = new Verify(); ify.VerifySrc = src; ify.SmartVerify = smartverify; ify.ShowDialog(); seccodeverify = Function.Instance.verifycode; } //seccodehash var seccodehash = verify; var seccodemodid = "forum::viewthread"; var formhash = Function.Instance.GetFormhash(smarthtml); var message = MsgSwitch(mode); var posttime = Function.Instance.GetTimeStamp(true); var referer = url; var posturl = "http://www.zlsoft.com/bbs/forum.php?mod=post&action=reply&fid=" + fid + "&tid=" + tid + "&extra=&replysubmit=yes&infloat=yes&handlekey=fastpost&inajax=1"; var postdata = "message=" + message + "&seccodehash=" + seccodehash + "&seccodemodid" + seccodemodid + "&seccodeverify=" + seccodeverify + "&posttime=" + posttime + "&formhash=" + formhash + "&usesig=1&subject="; var result = Function.Instance.GetHttpWebRequest(posturl, postdata, referer, Function.Instance.Cookie); if (result.Contains("succeedhandle_fastpost")) { if (Function.Instance.smartverify == true) { return "回帖:" + tid + " 成功(*智能识别验证码命中)"; } else { return "回帖:" + tid + " 成功"; } } else { hits = false; if (Function.Instance.smartverify == true) { return "回帖:" + tid + " 失败(*智能识别验证码未命中)"; } else { return "回帖:" + tid + " 失败"; } } } }