private void frm_Login_Load(object sender, EventArgs e) { //var ppay = Encrypt("fmy712", "15f6c805ba51da28a6350de6a2720f12"); //支付密码 //var pppay = Decrypt(ppay, "15f6c805ba51da28a6350de6a2720f12"); //ppay = XXTEA.Code(, "15f6c805ba51da28a6350de6a2720f12", XXTEAMode.Encrypt); PnOptor.Hide(); PnLogin.Show(); }
private void btnLoginOut_Click(object sender, EventArgs e) { tmrRandFloat.Stop(); tmrAutoInvest.Stop(); cookie = null; //File.Delete(cookiesDir + "/" + lblUserName.Text); PnOptor.Hide(); PnLogin.Show(); }
private void btn_Login_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtPayPWD.Text)) { txtLogs.AppendText("请输入支付密码!!!!\r\n"); return; } try { string file = null; if (rdoNewUser.Checked) { string userName = txt_UserName.Text.Trim(); string pwd = txt_Password.Text.Trim(); string dateStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string encryptPWD = Encrypt(dateStr + pwd, "oZ3qvmx4BTATvbI7", "oZ3qvmx4BTATvbI7"); var param = string.Format(@"format=json&appKey=00001&v=1.0×tamp={0}&method=sso.login&origin=1&source=1&vcode=''&cookieAge=7200&u={1}&p={2}&synUrl=https://jr.yatang.cn/index.php?s=/index/index/*type:1", dateStr, userName, encryptPWD); string res = WebHttpHeper.PostFormRequest(param, PageURL_Login, PageURL_LoginPost, ref cookie); dynamic data = null; data = JSON.DeserializeDynamic(res); if (data.code == "0") { lblUserName.Text = txt_UserName.Text; PnOptor.Show(); PnLogin.Hide(); if (!Directory.Exists(cookiesDir)) { Directory.CreateDirectory(cookiesDir); } file = cookiesDir + "/" + lblUserName.Text; WriteCookiesToDisk(file, cookie); if (data.isRedirect) { SetUserCookieAnUserLoginStatus(data.redirectUrl.ToString().Trim('"')); return; } //其他处理 return; } txtLogs.AppendText(data.message.ToString() + data.data + "\r\n"); } else { lblUserName.Text = cboSelectUser.SelectedItem.ToString(); cookie = CookiesDict[lblUserName.Text]; SetUserCookieAnUserLoginStatus("https://jr.yatang.cn/index.php?s=/index/index/*type:1"); PnLogin.Hide(); PnOptor.Show(); } CookieCollection collection = cookie.GetCookies(new Uri(PageURL_Base, UriKind.Absolute)); Cookie ckItem = collection["PayPWD"]; if (ckItem == null) { cookie.SetCookies(new Uri(PageURL_Base, UriKind.Absolute), "PayPWD=" + txtPayPWD.Text); file = cookiesDir + "/" + lblUserName.Text; WriteCookiesToDisk(file, cookie); } lblPayPWD.Text = txtPayPWD.Text; } catch (Exception ex) { txtLogs.AppendText("系统异常:" + ex.Message + "\r\n"); } }