protected void Page_Load(object sender, EventArgs e) { string nick = utils.NewRequest("nick", utils.RequestType.QueryString); string top_session = utils.NewRequest("session", utils.RequestType.QueryString); string iscrm = utils.NewRequest("iscrm", utils.RequestType.QueryString); Common.Cookie cookie = new Common.Cookie(); cookie.setCookie("top_session", top_session, 999999); cookie.setCookie("nick", nick, 999999); if (iscrm == "1") { cookie.setCookie("iscrm", "1", 999999); } Rijndael_ encode = new Rijndael_("tetesoft"); nick = encode.Decrypt(nick); //写入数据库 if (iscrm == "1") { string sql = "SELECT COUNT(*) FROM TCS_CrmConfig WHERE nick = '" + nick + "'"; string count = utils.ExecuteString(sql); if (count == "0") { sql = "INSERT INTO TCS_CrmConfig (nick, session, updatedate) VALUES ('" + nick + "','" + top_session + "','" + DateTime.Now.AddMonths(-3).ToString() + "')"; Response.Write(sql); utils.ExecuteNonQuery(sql); } } }
/// <summary> /// 输出验证码 /// </summary> private void OutPutVerify() { try { Train t = new Train(); string cookieStr = t.GetVerifyImg(); Common.Cookie cookie = new Common.Cookie(); string[] ary = cookieStr.Split('|'); cookie.setCookie("JSESSIONID", ary[0], 999999); if (ary.Length > 1) { cookie.setCookie("BIGipServerotsweb", ary[1], 999999); } Log(cookieStr); Response.End(); } catch { Response.Write("err"); Response.End(); } }
/// <summary> /// //////////////////////////////////////////// /// </summary> /// <param name="t"></param> /// <param name="u"></param> private void CheckUser(string t, string u) { string top_appkey = "12132145"; string app_secret = "1fdd2aadd5e2ac2909db2967cbb71e7f"; string sql = string.Empty; IDictionary <string, string> param = new Dictionary <string, string>(); param.Add("nick", u); param.Add("article_code", "service-0-22762"); string resultnew = Post("http://gw.api.taobao.com/router/rest", top_appkey, app_secret, "taobao.vas.subscribe.get", "", param); Regex reg = new Regex(@"<article_user_subscribe><item_code>([^<]*)</item_code><deadline>([^<]*)</deadline></article_user_subscribe>", RegexOptions.IgnoreCase); //更新日期 MatchCollection match = reg.Matches(resultnew); Common.Cookie cookie = new Common.Cookie(); for (int i = 0; i < match.Count; i++) { try { //腾讯微博自动推广 if (match[i].Groups[1].ToString() == "service-0-22762-9") { param = new Dictionary <string, string>(); string result = Post("http://gw.api.taobao.com/router/rest", top_appkey, app_secret, "taobao.increment.customer.permit", top_session, param); cookie.setCookie("mircoblog", "1", 999999); } //腾讯微博自动fensi if (match[i].Groups[1].ToString() == "service-0-22762-10") { cookie.setCookie("act", "1", 999999); } //CRM客户端收费 if (match[i].Groups[1].ToString() == "service-0-22762-4") { cookie.setCookie("iscrm", "1", 999999); } //特特统计收费 if (match[i].Groups[1].ToString() == "service-0-22762-8") { cookie.setCookie("istongji", "1", 999999); } //手机客户端 if (match[i].Groups[1].ToString() == "service-0-22762-6") { cookie.setCookie("mobile", "1", 999999); } } catch { } } }
protected void Page_Load(object sender, EventArgs e) { string q = utils.NewRequest("q", utils.RequestType.QueryString); string url = "http://captcha.qq.com/getimage?aid=46000101&r=0.03370694697363402&vc_type=5dedbca8871cd5308d6ad6d641e3539c386932b3dfc8c5a1&uin=" + q; string strHtml = string.Empty; StreamReader sr = null; //用来读取流 StreamWriter sw = null; //用来写文件 Encoding code = Encoding.GetEncoding("utf-8"); //定义编码 ASCIIEncoding encoding = new ASCIIEncoding(); //构造web请求,发送请求,获取响应 WebRequest HttpWebRequest = null; HttpWebRequest = WebRequest.Create(url); WebResponse HttpWebResponse = null; HttpWebResponse = HttpWebRequest.GetResponse(); //获得流 //sr = new StreamReader(HttpWebResponse.GetResponseStream(), code); //strHtml = sr.ReadToEnd(); byte[] arrayByte; Stream stream = HttpWebResponse.GetResponseStream(); //获取服务器设置的COOKIE if (HttpWebResponse.Headers.ToString().IndexOf("Set-Cookie") != -1) { string cookiestr = HttpWebResponse.Headers.Get("Set-Cookie").ToString(); Regex reg = new Regex(@"verifysession\=([^;]*)\;"); string verify = string.Empty; if (reg.IsMatch(cookiestr)) { Match match = reg.Match(cookiestr); verify = match.Groups[1].ToString(); //保存进COOKIE Common.Cookie cookie = new Common.Cookie(); cookie.setCookie("qqverify", verify, 999999); } } //保存图片 int imgLong = (int)HttpWebResponse.ContentLength; arrayByte = new byte[imgLong]; int l = 0; while (l < imgLong) { int i = stream.Read(arrayByte, 0, imgLong); l += i; } stream.Close(); HttpWebResponse.Close(); Response.ClearContent(); Response.ContentType = "image/gif"; Response.BinaryWrite(arrayByte); }
private void GetData(string nick) { string session = top_session; TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", top_appkey, app_secret); //获取店铺基本信息 UserGetRequest request = new UserGetRequest(); request.Fields = "user_id,nick,seller_credit"; request.Nick = nick; string oldNick = nick; User user = client.UserGet(request, session); if (CheckUserExits(nick)) { //更新登录次数和最近登陆时间 string sql = "UPDATE TCS_ShopSession SET session='" + top_session + "',version='" + versionNo + "' WHERE nick = '" + nick + "'"; utils.ExecuteNonQuery(sql); } else { //记录该会员的店铺信息 InsertUserInfo(nick); } IDictionary <string, string> param = new Dictionary <string, string>(); string result = Post("http://gw.api.taobao.com/router/rest", top_appkey, app_secret, "taobao.increment.customer.permit", top_session, param); //更新用户订购信息 CheckUser("0", nick); //加密NICK Rijndael_ encode = new Rijndael_("tetesoft"); nick = encode.Encrypt(nick); Common.Cookie cookie = new Common.Cookie(); cookie.setCookie("top_sessionsale", top_session, 999999); cookie.setCookie("nick", nick, 999999); Response.Redirect("indexsale.html"); }
protected void btnSearch3_Click(object sender, EventArgs e) { string uid = "*****@*****.**"; string pass = "******"; //准备生成 string strHtml = string.Empty; StreamReader sr = null; //用来读取流 StreamWriter sw = null; //用来写文件 Encoding code = Encoding.GetEncoding("utf-8"); //定义编码 ASCIIEncoding encoding = new ASCIIEncoding(); //构造POST请求 string postData = "service=sso&client=ssologin.js%28v1.3.9%29&entry=blog&encoding=utf-8&gateway=1&savestate=0&from=&useticket=0&username="******"&password="******"&callback=parent.sinaSSOController.loginCallBack&returntype=IFRAME&setdomain=1"; byte[] data = code.GetBytes(postData); //构造web请求,发送请求,获取响应 HttpWebRequest HttpWebRequest = null; string url = "http://login.sina.com.cn/sso/login.php?client=ssologin.js(v1.3.9)"; HttpWebRequest = (HttpWebRequest)WebRequest.Create(url); HttpWebRequest.Method = "POST"; HttpWebRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E)"; HttpWebRequest.ContentType = "application/x-www-form-urlencoded"; HttpWebRequest.ContentLength = data.Length; Stream newStream = HttpWebRequest.GetRequestStream(); newStream.Write(data, 0, data.Length); newStream.Close(); //发送 WebResponse HttpWebResponse = null; HttpWebResponse = HttpWebRequest.GetResponse(); string aaa = HttpWebResponse.Headers.Get("Set-Cookie").ToString(); //获得流 sr = new StreamReader(HttpWebResponse.GetResponseStream(), code); strHtml = sr.ReadToEnd(); string cookieStr = string.Empty; //cookieStr += getKeyData(@"tgc=([^;]*);", aaa); cookieStr += getKeyData(@"SUE=([^;]*);", aaa); cookieStr += getKeyData(@"SUP=([^;]*);", aaa); // cookieStr += getKeyData(@"domain=([^;]*);", aaa); //保存进COOKIE Common.Cookie cookie = new Common.Cookie(); cookie.setCookie("sinaCookie", cookieStr.Replace(";", "|"), 999999); Response.Write(cookieStr); }
protected void Page_Load(object sender, EventArgs e) { string nick = utils.NewRequest("nick", utils.RequestType.QueryString); string sql = "SELECT * FROM TCS_ShopSession WHERE nick = '" + nick + "' AND version > 0 AND version < 4"; Common.Cookie cookie = new Common.Cookie(); DataTable dt = utils.ExecuteDataTable(sql); if (dt.Rows.Count != 0) { Rijndael_ encode = new Rijndael_("tetesoft"); nick = encode.Encrypt(nick); cookie.setCookie("top_sessionblog", dt.Rows[0]["session"].ToString(), 999999); cookie.setCookie("nick", nick, 999999); } else { cookie.delCookie("top_sessionblog"); cookie.delCookie("nick"); } }
/// <summary> /// 发送博文 /// </summary> /// <param name="str"></param> /// <param name="str_2"></param> private void AddBlogCookie() { Common.Cookie cookie = new Common.Cookie(); string sinaCookie = cookie.getCookie("sinaCookie"); string trueSinaCookie = sinaCookie.Replace("|", ";"); //准备生成 string strHtml = string.Empty; StreamReader sr = null; //用来读取流 Encoding code = Encoding.GetEncoding("utf-8"); //定义编码 ASCIIEncoding encoding = new ASCIIEncoding(); //构造web请求,发送请求,获取响应 HttpWebRequest HttpWebRequest = null; HttpWebRequest = (HttpWebRequest)WebRequest.Create("http://control.blog.sina.com.cn/admin/article/article_add.php?index"); HttpWebRequest.Headers.Set("Cookie", trueSinaCookie); //HttpWebRequest.Method = "POST"; // HttpWebRequest.ContentType = "application/x-www-form-urlencoded"; //HttpWebRequest.ContentLength = data.Length; //Stream newStream = HttpWebRequest.GetRequestStream(); //newStream.Write(data, 0, data.Length); //newStream.Close(); //发送 WebResponse HttpWebResponse = null; HttpWebResponse = HttpWebRequest.GetResponse(); //获得流 string aaa = HttpWebResponse.Headers.Get("Set-Cookie").ToString(); string cookieStr = string.Empty; cookieStr += getKeyData(@"SessionID=([^;]*);", aaa); cookieStr += getKeyData(@"SINABLOGNUINFO=([^;]*);", aaa); cookieStr += getKeyData(@"expires=([^;]*);", aaa); cookieStr += getKeyData(@"IDC_LOGIN=([^;]*);", aaa); cookieStr += getKeyData(@"SINABLOGNUINFO=([^;]*);", aaa); //保存进COOKIE cookie.setCookie("sinaCookieAdd", cookieStr, 999999); }
/// <summary> /// 根据网页地址获取返回HTML /// </summary> /// <param name="url"></param> /// <returns></returns> private string GetHtmlByUrlget(string url, string cookie) { //准备生成 string strHtml = string.Empty; StreamReader sr = null; //用来读取流 Encoding code = Encoding.GetEncoding("utf-8"); //定义编码 ASCIIEncoding encoding = new ASCIIEncoding(); //构造web请求,发送请求,获取响应 HttpWebRequest HttpWebRequest = null; HttpWebRequest = (HttpWebRequest)WebRequest.Create(url); HttpWebRequest.Headers.Set("Cookie", cookie); //发送 WebResponse HttpWebResponse = null; HttpWebResponse = HttpWebRequest.GetResponse(); //获得流 sr = new StreamReader(HttpWebResponse.GetResponseStream(), code); strHtml = sr.ReadToEnd(); //获取服务器设置的COOKIE if (HttpWebResponse.Headers.ToString().IndexOf("Set-Cookie") != -1) { string cookiestr = HttpWebResponse.Headers.Get("Set-Cookie").ToString(); Regex reg = new Regex(@"ptvfsession\=([^;]*)\;"); string verify = string.Empty; if (reg.IsMatch(cookiestr)) { Match match = reg.Match(cookiestr); verify = match.Groups[1].ToString(); //保存进COOKIE Common.Cookie cookie1 = new Common.Cookie(); cookie1.setCookie("qqverify", verify, 999999); } } return(strHtml); }
private void QQLogin() { Common.Cookie cookie = new Common.Cookie(); string verify = cookie.getCookie("qqverify"); string url = "http://ptlogin2.qq.com/login?u=" + Request.Form["tbUserName"] + "&p=" + Request.Form["tbPassword"].ToUpper() + "&verifycode=" + Request.Form["tbVerify"] + "&aid=46000101&u1=http%3A%2F%2Ft.qq.com&ptredirect=1&h=1&from_ui=1&dumy=&fp=loginerroralert"; //准备生成 string strHtml = string.Empty; StreamReader sr = null; //用来读取流 StreamWriter sw = null; //用来写文件 Encoding code = Encoding.GetEncoding("utf-8"); //定义编码 ASCIIEncoding encoding = new ASCIIEncoding(); //构造web请求,发送请求,获取响应 WebRequest HttpWebRequest = null; HttpWebRequest = WebRequest.Create(url); HttpWebRequest.Headers.Set("Cookie", "verifysession=" + verify + ";"); //发送 WebResponse HttpWebResponse = null; HttpWebResponse = HttpWebRequest.GetResponse(); //获得流 sr = new StreamReader(HttpWebResponse.GetResponseStream(), code); strHtml = sr.ReadToEnd(); string aaa = HttpWebResponse.Headers.Get("Set-Cookie").ToString(); //保存进COOKIE string cookieStr = string.Empty; cookieStr += getKeyData(@"pt2gguin=([^;]*);", aaa); cookieStr += getKeyData(@"uin=([^;]*);", aaa); cookieStr += getKeyData(@"skey=([^;]*);", aaa); cookieStr += getKeyData(@"ptcz=([^;]*);", aaa); //保存登录状态 Rijndael_ encode = new Rijndael_("tetesoft"); cookie.setCookie("tmpQQ", encode.Encrypt(cookieStr), 999999); cookieStr += "verifysession=" + verify + ";"; //请求说说首页获取COOKIE url = "http://t.qq.com"; HttpWebRequest = WebRequest.Create(url); HttpWebRequest.Headers.Set("Cookie", cookieStr); //获得流 sr = new StreamReader(HttpWebResponse.GetResponseStream(), code); strHtml = sr.ReadToEnd(); //发送 HttpWebResponse = null; HttpWebResponse = HttpWebRequest.GetResponse(); string direct = HttpWebResponse.ResponseUri.ToString(); url = direct; HttpWebRequest = WebRequest.Create(url); HttpWebRequest.Headers.Set("Cookie", cookieStr); //获得流 sr = new StreamReader(HttpWebResponse.GetResponseStream(), code); strHtml = sr.ReadToEnd(); //发送 HttpWebResponse = null; HttpWebResponse = HttpWebRequest.GetResponse(); string ccc = HttpWebResponse.Headers.ToString(); cookie.setCookie("tCookie", cookieStr.Replace(";", "|"), 999999); cookie.setCookie("directUrl", direct, 999999); return; }
private void GetData(string nick) { string session = top_session; //string session = "23200d282b335fc82ee9466c363c14f7e1b03"; TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12223169", "ff3d3442ab809930d187623ffad8e91e"); //通过获取当前会话客户的在销商品来获取用户NICK //ItemsOnsaleGetRequest request1 = new ItemsOnsaleGetRequest(); //request1.PageSize = 1; //request1.Fields = "nick"; //PageList<Item> item = client.ItemsOnsaleGet(request1, session); //if (item.Content.Count == 0) //{ // Response.Write("请您先在店铺里添加商品 <a href='http://i.taobao.com/my_taobao.htm'>我的淘宝</a>"); // Response.End(); // return; //} //else //{ // nick = item.Content[0].Nick; //} //获取店铺基本信息 UserGetRequest request = new UserGetRequest(); request.Fields = "user_id,nick,seller_credit"; request.Nick = nick; User user = client.UserGet(request, session); if (CheckUserExits(nick)) { //更新该会员的店铺信息 //string ip = Request.UserHostAddress; //记录2次登录日志 /*string sql = "INSERT INTO TopLoginLog (" + * "nick " + * " ) VALUES ( " + * " '" + nick + "'" + * ") "; * utils.ExecuteNonQuery(sql);*/ //更新登录次数和最近登陆时间 string sql = "UPDATE TCS_ShopSession SET session='" + top_session + "',version='" + versionNo + "' WHERE nick = '" + nick + "'"; utils.ExecuteNonQuery(sql); } else { //记录该会员的店铺信息 InsertUserInfo(nick); } IDictionary <string, string> param = new Dictionary <string, string>(); string result = Post("http://gw.api.taobao.com/router/rest", "12223169", "ff3d3442ab809930d187623ffad8e91e", "taobao.increment.customer.permit", top_session, param); //更新用户订购信息 CheckUser("0", nick); //加密NICK Rijndael_ encode = new Rijndael_("tetesoft"); nick = encode.Encrypt(nick); Common.Cookie cookie = new Common.Cookie(); cookie.setCookie("top_sessionkai", top_session, 999999); cookie.setCookie("nick", nick, 999999); Response.Redirect("indexkai.html"); }
protected void Page_Load(object sender, EventArgs e) { Response.AddHeader("P3P", "CP=CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"); /* * http://www.7fshop.com/top/container.aspx * ?top_appkey=12132145 * &top_parameters=aWZyYW1lPTEmdHM9MTI4NTg3MTY5Nzg0OSZ2aWV3X21vZGU9ZnVsbCZ2aWV3X3dpZHRoPTAmdmlzaXRvcl9pZD0xNzMyMzIwMCZ2aXNpdG9yX25pY2s90ra2+cvmx+W35w== * &top_session=23200857b2aa0ca62d3d0d9c78a750df07300 * &top_sign=52sdJ6lvJPeaBef7rwcoSw== * &agreement=true * &agreementsign=12132145-21431194-D1A5A27626CB119D69F0D5438423A99A * &y=13 * &x=36*/ //签名验证 string top_appkey = "12223169"; string top_parameters = utils.NewRequest("top_parameters", utils.RequestType.QueryString).Replace(" ", "+"); top_session = utils.NewRequest("top_session", utils.RequestType.QueryString).Replace(" ", "+"); string app_secret = "ff3d3442ab809930d187623ffad8e91e"; string top_sign = utils.NewRequest("top_sign", utils.RequestType.QueryString).Replace(" ", "+"); //字符串中的+在获取后会被替换成空格,要再替换回来 string sign = utils.NewRequest("sign", utils.RequestType.QueryString).Replace(" ", "+"); versionNo = utils.NewRequest("versionNo", utils.RequestType.QueryString); string leaseId = utils.NewRequest("leaseId", utils.RequestType.QueryString).Replace(" ", "+"); //可以从 QueryString 来获取,也可以固定 string timestamp = utils.NewRequest("timestamp", utils.RequestType.QueryString).Replace(" ", "+"); //可以从 QueryString 来获取 string agreementsign = utils.NewRequest("agreementsign", utils.RequestType.QueryString).Replace(" ", "+"); if (!Taobao.Top.Api.Util.TopUtils.VerifyTopResponse(top_parameters, top_session, top_sign, top_appkey, app_secret)) { Response.Write("top签名验证不通过,请不要非法注入"); Response.End(); return; } //验证客户版本参数是否正确 if (versionNo != "") { if (!VersionVerify(app_secret, sign, top_appkey, leaseId, timestamp, versionNo)) { //Response.Write("客户版本验证不通过,请不要自行修改参数"); //Response.End(); //return; } } else { versionNo = "1"; } //Response.Write("!!!通过"); //Response.End(); nick = Taobao.Top.Api.Util.TopUtils.DecodeTopParams(top_parameters)["visitor_nick"]; if (nick == null || nick == "") { Response.Write("top签名验证不通过,请不要非法注入"); Response.End(); return; } if (agreementsign != "") { //加密NICK Rijndael_ encode = new Rijndael_("tetesoft"); nick = encode.Encrypt(nick); Common.Cookie cookie = new Common.Cookie(); cookie.setCookie("top_sessionkai", top_session, 999999); cookie.setCookie("nick", nick, 999999); Response.Redirect("indexkai.html"); return; } //判断跳转 GetData(nick); }
private string QQLogin() { Common.Cookie cookie = new Common.Cookie(); string verify = cookie.getCookie("qqverify"); string url = "http://ptlogin2.qq.com/login?u=" + Request.Form["tbUserName"] + "&p=" + Request.Form["tbPassword"].ToUpper() + "&verifycode=" + Request.Form["tbVerify"] + "&aid=46000101&u1=http%3A%2F%2Ft.qq.com&ptredirect=1&h=1&from_ui=1&dumy=&fp=loginerroralert"; url = "http://ptlogin2.qq.com/login?u=" + Request.Form["tbUserName"] + "&p=" + Request.Form["tbPassword"].ToUpper() + "&verifycode=" + Request.Form["tbVerify"] + "&low_login_enable=1&low_login_hour=720&=on&aid=15000101&u1=http%3A%2F%2Fimgcache.qq.com%2Fqzone%2Fv5%2Floginsucc.html%3Fpara%3Dizone&ptredirect=1&h=1&from_ui=1&dumy=&fp=loginerroralert"; //准备生成 string strHtml = string.Empty; StreamReader sr = null; //用来读取流 StreamWriter sw = null; //用来写文件 Encoding code = Encoding.GetEncoding("utf-8"); //定义编码 ASCIIEncoding encoding = new ASCIIEncoding(); //构造web请求,发送请求,获取响应 WebRequest HttpWebRequest = null; HttpWebRequest = WebRequest.Create(url); HttpWebRequest.Headers.Set("Cookie", "verifysession=" + verify + ";"); //if (proxy != "") //{ // string[] proxyArray = proxy.Split(':'); // HttpWebRequest.Proxy = new WebProxy(proxyArray[0], int.Parse(proxyArray[1])); // HttpWebRequest.Timeout = 40000; //} //发送 WebResponse HttpWebResponse = null; HttpWebResponse = HttpWebRequest.GetResponse(); //获得流 sr = new StreamReader(HttpWebResponse.GetResponseStream(), code); strHtml = sr.ReadToEnd(); //如果验证错误 /*if (strHtml.IndexOf("您输入的验证码有误") != -1) * { * Response.Write("<script>alert('您输入的验证码或帐号密码有误,请重新输入!');history.go(-1);</script>"); * Response.End(); * return ""; * }*/ //Response.Write("<script>alert('QQ空间自动发布程序升级中,请稍后使用!');history.go(-1);</script>"); //Response.End(); //return ""; string aaa = string.Empty; try { aaa = HttpWebResponse.Headers.Get("Set-Cookie").ToString(); } catch { Response.Write(verify + "<br>"); Response.Write(strHtml + "<br>"); Response.Write(HttpWebResponse.Headers.ToString()); Response.End(); return(""); } //保存进COOKIE string cookieStr = string.Empty; cookieStr += getKeyData(@"pt2gguin=([^;]*); ", aaa); cookieStr += getKeyData(@"ptcz=([^;]*); ", aaa); cookieStr += getKeyData(@"uin=([^;]*); ", aaa); cookieStr += getKeyData(@"skey=([^;]*); ", aaa); //保存登录状态 Rijndael_ encode = new Rijndael_("tetesoft"); cookie.setCookie("tmpQQ", encode.Encrypt(cookieStr), 999999); //cookieStr += "verifysession=" + verify + ";"; cookieStr += "ptisp=ctc;"; //请求说说首页获取COOKIE //url = "http://t.qq.com"; //HttpWebRequest = WebRequest.Create(url); //HttpWebRequest.Headers.Set("Cookie", cookieStr); ////获得流 //sr = new StreamReader(HttpWebResponse.GetResponseStream(), code); //strHtml = sr.ReadToEnd(); ////发送 //HttpWebResponse = null; //HttpWebResponse = HttpWebRequest.GetResponse(); //string direct = HttpWebResponse.ResponseUri.ToString(); //url = direct; //HttpWebRequest = WebRequest.Create(url); //HttpWebRequest.Headers.Set("Cookie", cookieStr); ////获得流 //sr = new StreamReader(HttpWebResponse.GetResponseStream(), code); //strHtml = sr.ReadToEnd(); ////发送 //HttpWebResponse = null; //HttpWebResponse = HttpWebRequest.GetResponse(); //string ccc = HttpWebResponse.Headers.ToString(); //cookie.setCookie("tCookie", cookieStr.Replace(";", "|"), 999999); //cookie.setCookie("directUrl", direct, 999999); return(cookieStr); }
private void GetData(string nick) { string session = top_session; //string session = "23200d282b335fc82ee9466c363c14f7e1b03"; TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5"); //通过获取当前会话客户的在销商品来获取用户NICK //ItemsOnsaleGetRequest request1 = new ItemsOnsaleGetRequest(); //request1.PageSize = 1; //request1.Fields = "nick"; //PageList<Item> item = client.ItemsOnsaleGet(request1, session); //if (item.Content.Count == 0) //{ // Response.Write("请您先在店铺里添加商品 <a href='http://i.taobao.com/my_taobao.htm'>我的淘宝</a>"); // Response.End(); // return; //} //else //{ // nick = item.Content[0].Nick; //} //获取店铺基本信息 UserGetRequest request = new UserGetRequest(); request.Fields = "user_id,nick,seller_credit"; request.Nick = nick; User user = client.UserGet(request, session); if (CheckUserExits(nick)) { //更新该会员的店铺信息 //记录2次登录日志 string sql = "INSERT INTO TopLoginLog (" + "nick " + " ) VALUES ( " + " '" + nick + "'" + ") "; utils.ExecuteNonQuery(sql); //更新登录次数和最近登陆时间 sql = "UPDATE toptaobaoshop SET logintimes = logintimes + 1,lastlogin = GETDATE(),session='" + top_session + "',versionNo='" + versionNo + "' WHERE nick = '" + nick + "'"; utils.ExecuteNonQuery(sql); } else { //记录该会员的店铺信息 InsertUserInfo(nick); } //更新用户订购信息 CheckUser("0", nick); //加密NICK Rijndael_ encode = new Rijndael_("tetesoft"); nick = encode.Encrypt(nick); Common.Cookie cookie = new Common.Cookie(); cookie.setCookie("top_sessionblog", top_session, 999999); cookie.setCookie("nick", nick, 999999); Response.Redirect("indexnew.html"); }
protected void Page_Load(object sender, EventArgs e) { Common.Cookie cookie1 = new Common.Cookie(); string nick = cookie1.getCookie("nickweibo"); string appKey = "d3225497956249cbb13a7cb7375d62bd"; string appSecret = "6cf7a3274cb676328e77dff3e203061d"; tokenKey = utils.NewRequest("oauth_token", utils.RequestType.QueryString); tokenSecret = Session["tokenSecret"].ToString(); string verify = utils.NewRequest("oauth_verifier", utils.RequestType.QueryString); //获取账户信息 GetAccessToken(appKey, appSecret, tokenKey, tokenSecret, verify); Common.Cookie cookie = new Common.Cookie(); cookie.setCookie("tokenKey", tokenKey, 999999); cookie.setCookie("tokenSecret", tokenSecret, 999999); List <Parameter> parameters = new List <Parameter>(); List <Parameter> files = new List <Parameter>(); //身份验证 OauthKey oauthKey = new OauthKey(); oauthKey.customKey = appKey; oauthKey.customSecrect = appSecret; oauthKey.tokenKey = tokenKey; oauthKey.tokenSecrect = tokenSecret; QWeiboRequest request = new QWeiboRequest(); int nKey = 0; if (request.AsyncRequest("http://open.t.qq.com/api/statuses/broadcast_timeline", "POST", oauthKey, parameters, files, new AsyncRequestCallback(RequestCallback), out nKey)) { //textOutput.Text = "请求中..."; } cookie.setCookie("uid", weiboName, 999999); //insert sql string sql = "SELECT COUNT(*) FROM TopMicroBlogAccount WHERE typ = 'qq' AND uid = '" + weiboName + "'"; string count = utils.ExecuteString(sql); if (count == "0") { if (weiboName != "") { //写入数据库 sql = "INSERT INTO TopMicroBlogAccount (nick, uid, typ, tokenKey, tokenSecrect) VALUES ('" + nick + "', '" + weiboName + "', 'qq', '" + tokenKey + "', '" + tokenSecret + "')"; utils.ExecuteNonQuery(sql); //赠送积分 //记录操作日志 sql = "INSERT INTO TopMicroBlogNumLog (uid, typ, num) VALUES ('" + weiboName + "', 'reg', 5)"; utils.ExecuteNonQuery(sql); //增加积分 sql = "UPDATE TopMicroBlogAccount SET score = score + 5 WHERE uid = '" + weiboName + "'"; utils.ExecuteNonQuery(sql); } Response.Redirect("menu.aspx"); } else { string num = new Random(int.Parse(DateTime.Now.Second.ToString())).Next(0, 100).ToString(); string str = "#互听##互听工具#【特特互听】我在用的免费互听工具,可以安全迅速的增加听众~~(" + num + ")..http://weibo.tetesoft.com"; //string score = utils.ExecuteString("SELECT score FROM TopMicroBlogAccount WHERE uid = '" + weiboName + "'"); sql = "SELECT * FROM TopMicroBlogAccount WHERE uid = '" + weiboName + "'"; DataTable dtUser = utils.ExecuteDataTable(sql); if (dtUser.Rows.Count == 0) { return; } string score = dtUser.Rows[0]["score"].ToString(); tokenKey = dtUser.Rows[0]["tokenKey"].ToString(); tokenSecret = dtUser.Rows[0]["tokenSecrect"].ToString(); if (int.Parse(score) > 20) { //登录增加20个粉丝 sql = "SELECT TOP 20 * FROM TopMicroBlogAccount WHERE typ = 'qq' AND score > 0 AND uid <> '' ORDER BY NEWID()"; DataTable dt = utils.ExecuteDataTable(sql); for (int i = 0; i < dt.Rows.Count; i++) { listen(dt.Rows[i]["uid"].ToString(), weiboName, dt.Rows[i]["tokenKey"].ToString(), dt.Rows[i]["tokenSecrect"].ToString()); } } SendMessage(str); } }
private void GetData(string nick) { string session = top_session; TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5"); //获取店铺基本信息 UserGetRequest request = new UserGetRequest(); request.Fields = "user_id,nick,seller_credit"; request.Nick = nick; string oldNick = nick; User user = client.UserGet(request, session); if (versionNo == "1") { versionNo = "2"; } if (CheckUserExits(nick)) { string plus = string.Empty; if (versionNo == "2") { plus = "freecard"; } if (versionNo == "3") { plus = "crm|freecard"; } //更新登录次数和最近登陆时间 string sql = "UPDATE TCS_ShopSession SET session='" + top_session + "',version='" + versionNo + "',plus='" + plus + "' WHERE nick = '" + nick + "'"; utils.ExecuteNonQuery(sql); //更新特殊用户 sql = "UPDATE TCS_ShopSession SET version = 2 WHERE nick = '玩具第一城'"; utils.ExecuteNonQuery(sql); //更新特殊用户 sql = "UPDATE TCS_ShopSession SET version = 3 WHERE nick = '魔女茶花'"; utils.ExecuteNonQuery(sql); } else { //记录该会员的店铺信息 InsertUserInfo(nick); } InsertConfigInfo(nick, session, versionNo); IDictionary <string, string> param = new Dictionary <string, string>(); string result = Post("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5", "taobao.increment.customer.permit", top_session, param); //更新用户订购信息 CheckUser("0", nick); //加密NICK Rijndael_ encode = new Rijndael_("tetesoft"); nick = encode.Encrypt(nick); Common.Cookie cookie = new Common.Cookie(); cookie.setCookie("top_sessionblog", top_session, 999999); cookie.setCookie("top_sessiongroupbuy", top_session, 999999); cookie.setCookie("nick", nick, 999999); //Response.Redirect("http://www.7fshop.com/top/market/setcookie.aspx?t=1&nick=" + HttpUtility.UrlEncode(nick)); if (isFirst == "1") { Response.Write("<span style='font-size:18px; font-weight:bold'>好评有礼真情回馈,恭喜您获得我们送出的首次订购赠送的<font color=red>【" + sendMsg + "】</font>条短信,感谢您的使用,您的支持是我们的最大动力!</span><hr><input type=button value='开始使用服务' onclick='window.location.href=\"indexnew.html\"'>"); Response.End(); } else { Response.Redirect("indexnew.html"); } }
protected void Page_Load(object sender, EventArgs e) { Response.AddHeader("P3P", "CP=CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"); string strSPID = "29230000ea039296234e9d74d8d3d5b7"; string strSKEY = "2dsi35b3fdx050a41jufbnzirrlqd9kl"; string strUIN = utils.NewRequest("useruin", utils.RequestType.QueryString); string strTOKEN = utils.NewRequest("usertoken", utils.RequestType.QueryString); ApiClient client = new ApiClient(strSPID, strSKEY, Convert.ToInt32(strUIN), strTOKEN); //通过以下的接口函数添加这些参数 client.addParamInStringField("sellerUin", strUIN); client.invokeApi("http://api.paipai.com/shop/getShopInfo.xhtml?charset=utf-8"); string result = client.ToString(); string sql = string.Empty; //记录到本地数据库 sql = "SELECT COUNT(*) FROM TopPaipaiShop WHERE sellerUin = '" + strUIN + "'"; string count = utils.ExecuteString(sql); if (count == "0") { sql = "INSERT INTO TopPaipaiShop (" + "sellerUin, " + "shopName, " + "logo, " + "regTime, " + "authenticated, " + "mainBusiness, " + "sellerLocation, " + "cityId, " + "sellerLevelCount, " + "guaranteeCompensation, " + "property, " + "itemCountOnSale, " + "goodDescriptionMatch, " + "attitudeOfService, " + "speedOfDelivery, " + "goodEval, " + "normalEval, " + "badEval, " + "sigTencent, " + "sigPaipai " + " ) VALUES ( " + " '" + getValue(result, "sellerUin") + "', " + " '" + getValue(result, "shopName") + "', " + " '" + getValue(result, "logo") + "', " + " '" + getValue(result, "regTime") + "', " + " '" + getValue(result, "authenticated") + "', " + " '" + getValue(result, "mainBusiness") + "', " + " '" + getValue(result, "sellerLocation") + "', " + " '" + getValue(result, "cityId") + "', " + " '" + getValue(result, "sellerLevelCount") + "', " + " '" + getValue(result, "guaranteeCompensation") + "', " + " '" + getValue(result, "property") + "', " + " '" + getValue(result, "itemCountOnSale") + "', " + " '" + getValue(result, "goodDescriptionMatch") + "', " + " '" + getValue(result, "attitudeOfService") + "', " + " '" + getValue(result, "speedOfDelivery") + "', " + " '" + getValue(result, "goodEval") + "', " + " '" + getValue(result, "normalEval") + "', " + " '" + getValue(result, "badEval") + "', " + " '" + getValue(result, "sigTencent") + "', " + " '" + getValue(result, "sigPaipai") + "' " + ") "; } else { sql = "UPDATE TopPaipaiShop SET lastlogin = GETDATE(), logintimes = logintimes + 1 WHERE sellerUin = '" + strUIN + "'"; } Rijndael_ encode = new Rijndael_("tetesoft"); strUIN = encode.Encrypt(strUIN); Common.Cookie cookie = new Common.Cookie(); cookie.setCookie("top_session", strTOKEN, 999999); cookie.setCookie("nick", strUIN, 999999); utils.ExecuteNonQuery(sql); Response.Redirect("qqindex.html"); }
protected void Page_Load(object sender, EventArgs e) { string nick = utils.NewRequest("nick", utils.RequestType.QueryString); string t = utils.NewRequest("t", utils.RequestType.QueryString); Common.Cookie cookie = new Common.Cookie(); //清理之前的COOKIE cookie.delCookie("mircoblog"); cookie.delCookie("act"); cookie.delCookie("iscrm"); cookie.delCookie("istongji"); cookie.delCookie("istongji"); cookie.setCookie("nick", nick, 999999); Rijndael_ encode = new Rijndael_("tetesoft"); string taobaoNick = encode.Decrypt(nick); //查询是否订购了免费版 string sql = "SELECT * FROM TopTaobaoShop WHERE nick = '" + taobaoNick + "'"; DataTable dt = utils.ExecuteDataTable(sql); if (dt.Rows.Count != 0) { string session = dt.Rows[0]["sessionmarket"].ToString(); cookie.setCookie("top_session", session, 999999); string top_appkey = "12132145"; string app_secret = "1fdd2aadd5e2ac2909db2967cbb71e7f"; IDictionary <string, string> param = new Dictionary <string, string>(); param.Add("nick", taobaoNick); param.Add("article_code", "service-0-22762"); string resultnew = Post("http://gw.api.taobao.com/router/rest", top_appkey, app_secret, "taobao.vas.subscribe.get", "", param); Regex reg = new Regex(@"<article_user_subscribe><item_code>([^<]*)</item_code><deadline>([^<]*)</deadline></article_user_subscribe>", RegexOptions.IgnoreCase); //更新日期 MatchCollection match = reg.Matches(resultnew); for (int i = 0; i < match.Count; i++) { try { //腾讯微博自动推广 if (match[i].Groups[1].ToString() == "service-0-22762-9") { param = new Dictionary <string, string>(); string result = Post("http://gw.api.taobao.com/router/rest", top_appkey, app_secret, "taobao.increment.customer.permit", session, param); cookie.setCookie("mircoblog", "1", 999999); } //腾讯微博自动fensi if (match[i].Groups[1].ToString() == "service-0-22762-10") { cookie.setCookie("act", "1", 999999); } //CRM客户端收费 if (match[i].Groups[1].ToString() == "service-0-22762-4") { cookie.setCookie("iscrm", "1", 999999); } //特特统计收费 if (match[i].Groups[1].ToString() == "service-0-22762-8") { cookie.setCookie("istongji", "1", 999999); } } catch { } } } if (t != "") { Response.Redirect("../index.html?t=" + t); } else { Response.Redirect("../index.html"); } }
private void GetData(string nick) { string session = top_session; //string session = "23200d282b335fc82ee9466c363c14f7e1b03"; TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12579331", "02314dab9db5c4255129ad772dd65424"); //通过获取当前会话客户的在销商品来获取用户NICK //ItemsOnsaleGetRequest request1 = new ItemsOnsaleGetRequest(); //request1.PageSize = 1; //request1.Fields = "nick"; //PageList<Item> item = client.ItemsOnsaleGet(request1, session); //if (item.Content.Count == 0) //{ // Response.Write("请您先在店铺里添加商品 <a href='http://i.taobao.com/my_taobao.htm'>我的淘宝</a>"); // Response.End(); // return; //} //else //{ // nick = item.Content[0].Nick; //} //获取店铺基本信息 /*UserGetRequest request = new UserGetRequest(); * request.Fields = "user_id,nick,seller_credit"; * request.Nick = nick; * User user = client.UserGet(request, session);*/ //加入推荐好友判断 Tuijian(nick); if (CheckUserExits(nick)) { //更新该会员的店铺信息 string ip = Request.UserHostAddress; //记录2次登录日志 string sql = "INSERT INTO TopLoginLog (" + "nick " + " ) VALUES ( " + " '" + nick + "'" + ") "; utils.ExecuteNonQuery(sql); //更新登录次数和最近登陆时间 sql = "UPDATE toptaobaoshop SET logintimes = logintimes + 1,lastlogin = GETDATE(),session='" + top_session + "',sessionmarket='" + top_session + "',ip='" + ip + "' WHERE nick = '" + nick + "'"; utils.ExecuteNonQuery(sql); } else { try { //记录该会员的店铺信息 InsertUserInfo(nick); } catch { } } try { //更新用户订购信息 CheckUser("1", nick); } catch { } //加密NICK Rijndael_ encode = new Rijndael_("tetesoft"); nick = encode.Encrypt(nick); Common.Cookie cookie = new Common.Cookie(); cookie.setCookie("top_sessionbao", top_session, 999999); cookie.setCookie("nick", nick, 999999); Response.Redirect("indexbao.html"); }