Example #1
0
        public void GuiTin(ThongTinTaiKhoan nguoigui, ThongTinTaiKhoan nguoinhan, string tieude, string noidung, Action <string> callback = null)
        {
            //Lấy thông tin tài khoản nhận thư
            if (string.IsNullOrEmpty(nguoinhan.Id))
            {
                var    thongTinNguoiNhanThu_Response  = RequestToWeb.GET(new Uri(nguoinhan.Url), false);
                string thongTinNguoiNhanThu_string    = RequestToWeb.ReadStream(thongTinNguoiNhanThu_Response);
                HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
                document.LoadHtml(thongTinNguoiNhanThu_string);
                var    thongTinNguoiNhanThu_message = document.DocumentNode.Descendants("li").Where(div => div.HasClass("message")).FirstOrDefault();
                string thongTinNguoiNhanThu_Url     = thongTinNguoiNhanThu_message.QuerySelector("a").GetAttributeValue("href", "");
                nguoinhan.Id = thongTinNguoiNhanThu_Url.Split('/')[7];
            }
            string guiThu_data     = string.Format("subject={0}&body={1}&submit=Gởi&ismessage=1", tieude, noidung);
            var    guiThu_Response = RequestToWeb.POST(new Uri(string.Format("http://www.timbangai.com/timbangai/account/messages/compose/{0}", nguoinhan.Id)), nguoigui.Cookie, guiThu_data, false);
            string guiThu_string   = RequestToWeb.ReadStream(guiThu_Response);

            if (guiThu_string == null)
            {
                nguoigui.ChoPhepGuiNhan = false;
                nguoigui.TrangThai      = "Chuyển tài khoản";
                nguoinhan.TrangThai     = "Gửi lỗi (Web không trả về dữ liệu để xử lý)";
                return;
            }

            if (guiThu_string == "")
            {
                nguoinhan.TrangThai = nguoigui.TaiKhoan;
            }
            else
            {
                nguoinhan.TrangThai = "Gửi lỗi";
            }
        }
Example #2
0
        public void DangNhap(ref ThongTinTaiKhoan tk)
        {
            tk.Cookie = new CookieContainer();
            #region Lấy cookie ban đầu
            var cookieBanDauResponse = RequestToWeb.GET(new Uri("http://cdn.likeyou.vn/sites/all/themes/jam_likeyou/images/bgfacbookren.png"), true, false, tk.Cookie);
            //var cookieBanDauResponse = RequestToWeb.GET(new Uri("http://media.likeyou.vn/"), true, false, tk.Cookie);
            #endregion

            #region Đăng nhập
            string data             = string.Format("name={0}&pass={1}&remember_me=1&form_id=user_login", tk.TaiKhoan, tk.MatKhau);
            var    dangNhapResponse = RequestToWeb.POST(new Uri("http://likeyou.vn/vi/user?destination=user"), tk.Cookie, data, false, true);
            string res = RequestToWeb.ReadStream(dangNhapResponse);
            if (dangNhapResponse.ResponseUri != null &&
                dangNhapResponse.ResponseUri.Query != null &&
                dangNhapResponse.ResponseUri.Query.Contains("user="******"Đang nhập thành công";
                tk.ChoPhepGuiNhan = true;
            }
            else
            {
                tk.TrangThai = "Sai tài khoản hoặc mật khẩu";
            }
            #endregion
        }
Example #3
0
        public void GuiTin(ThongTinTaiKhoan nguoigui, ThongTinTaiKhoan nguoinhan, string tieude, string noidung, Action <string> callback = null)
        {
            if (nguoigui.Cookie == null)
            {
                throw new Exception("Thiếu cookie");
            }

            string dataGui        = string.Format("fuid={0}&tuid={1}&message={2}&from_to={0}-{1}", nguoigui.Id, nguoinhan.Id, noidung);
            var    responseGuiTin = RequestToWeb.POST(new Uri("http://likeyou.vn/messages/send-message"), nguoigui.Cookie, dataGui, false);

            string phanHoi = Uri.UnescapeDataString(RequestToWeb.ReadStream(responseGuiTin));
            var    header3 = RequestToWeb.ReadHeader(responseGuiTin.Headers);

            if (phanHoi == "\n\n 1")
            {
                nguoinhan.TrangThai = nguoigui.TaiKhoan;
                System.Threading.Tasks.Task.Run(() =>
                {
                    //Để tự gửi lại 1 tìn => mới lưu vào hộp thư đến
                    dataGui = string.Format("fuid={1}&tuid={0}&from_to={1}-{0}", nguoigui.Id, nguoinhan.Id);
                    var gg  = RequestToWeb.POST(new Uri("http://likeyou.vn/messages/send-message"), nguoigui.Cookie, dataGui, true);
                });
            }
            else
            {
                nguoinhan.TrangThai = "Gửi lỗi";
            }
        }
        private void LayThongTinTrangNay()
        {
            HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
            document.LoadHtml(webBrowser1.Document.Body.OuterHtml);

            var xx = document.DocumentNode.QuerySelectorAll("table > tbody > tr > td").ToList();

            for (int i = 0; i < xx.Count; i++)
            {
                ThongTinTaiKhoan taiKhoan = new ThongTinTaiKhoan();
                var tenHienThi            = xx[i].QuerySelector("a");
                if (tenHienThi != null)
                {
                    string duongDan = tenHienThi.GetAttributeValue("href", "");
                    if (!string.IsNullOrEmpty(duongDan))
                    {
                        try
                        {
                            int    id  = Convert.ToInt32(duongDan.Split('/')[3]);
                            string ten = xx[i].InnerText.Split('\n')[4];

                            taiKhoan.Url        = string.Format("http://henho2.com{0}", duongDan);
                            taiKhoan.Id         = duongDan.Split('/')[3];
                            taiKhoan.TenHienThi = ten.Trim();

                            if ((thongTinTaiKhoanBindingSource.List as IList <ThongTinTaiKhoan>).Where(p => p.Id == taiKhoan.Id).FirstOrDefault() == null)
                            {
                                thongTinTaiKhoanBindingSource.Add(taiKhoan);
                            }
                        }
                        catch { }
                    }
                }
            }
        }
Example #5
0
        public static void Test()
        {
            ThongTinTaiKhoan tk = new ThongTinTaiKhoan();

            tk.Cookie = new CookieContainer();
            var cookieBanDauResponse = RequestToWeb.GET(new Uri("http://media.likeyou.vn/"), true, false, tk.Cookie);

            tk.TaiKhoan = "*****@*****.**";
            tk.MatKhau  = "*****@*****.**";

            string data             = string.Format("name={0}&pass={1}&remember_me=1&form_id=user_login", tk.TaiKhoan, tk.MatKhau);
            var    dangNhapResponse = RequestToWeb.POST(new Uri("http://likeyou.vn/vi/user?destination=user"), tk.Cookie, data, false, true);
            string res         = RequestToWeb.ReadStream(dangNhapResponse);
            var    loginHeader = RequestToWeb.ReadHeader(dangNhapResponse.Headers);

            if ((dangNhapResponse as HttpWebResponse).StatusCode == HttpStatusCode.Found)
            {
                if (dangNhapResponse.ResponseUri != null &&
                    dangNhapResponse.ResponseUri.Query != null &&
                    dangNhapResponse.ResponseUri.Query.Contains("user="******"Đang nhập thành công";
            }
            else
            {
                tk.TrangThai = "Đang nhập thất bại";
            }

            var    guiTin  = RequestToWeb.POST(new Uri("http://likeyou.vn/messages/send-message"), tk.Cookie, "fuid=636691&tuid=636421&message=Không có id người gửi", false);
            string s3      = Uri.UnescapeDataString(RequestToWeb.ReadStream(guiTin));
            var    header3 = RequestToWeb.ReadHeader(guiTin.Headers);
        }
        public async Task <Response <ThongTinTaiKhoan> > CapNhatTaiKhoan(long id, CapNhatTaiKhoanRequest request)
        {
            var taiKhoan = await _taiKhoanRepo.GetTaiKhoanById(id);

            if (taiKhoan == null)
            {
                return new Response <ThongTinTaiKhoan>
                       {
                           StatusCode = 400,
                           Success    = false,
                           Errors     = new[] { "Không tìm thấy tài khoản" }
                       }
            }
            ;

            taiKhoan.HoTen       = string.IsNullOrWhiteSpace(request.HoTen) ? "" : request.HoTen;
            taiKhoan.Email       = string.IsNullOrWhiteSpace(request.Email) ? "" : request.Email;
            taiKhoan.GioiTinh    = string.IsNullOrWhiteSpace(request.GioiTinh) ? "" : request.GioiTinh;
            taiKhoan.SoDienThoai = string.IsNullOrWhiteSpace(request.SoDienThoai) ? "" : request.SoDienThoai;

            var updatedTaiKhoan = await _taiKhoanRepo.UpdateTaiKhoan(taiKhoan);

            var data = new ThongTinTaiKhoan(updatedTaiKhoan);

            return(new Response <ThongTinTaiKhoan>
            {
                StatusCode = 200,
                Success = true,
                Errors = null,
                Data = data
            });
        }
    }
        public void GuiTin(ThongTinTaiKhoan nguoigui, ThongTinTaiKhoan nguoinhan, string tieude, string noidung, Action <string> callback = null)
        {
            if (nguoigui.Cookie == null)
            {
                throw new Exception("Thiếu cookie");
            }

            var    htmlGet       = RequestToWeb.GET(new Uri("https://www.webtretho.com/forum/private.php?do=newpm"), false, true, nguoigui.Cookie).ReadStream();
            string securitytoken = htmlGet.Substring("SECURITYTOKEN = \"", "\";");

            string data = string.Join("&", new[]
            {
                $"recipients={nguoinhan.TaiKhoan}",
                "bccrecipients=",
                $"title={tieude}",
                $"message_backup={noidung}",
                $"message={noidung}",
                "wysiwyg=0",
                "iconid=0",
                "s=",
                $"securitytoken={securitytoken}",
                "do=insertpm",
                "pmid=",
                "forward=",
                "sbutton=Gửi tin nhắn",
                "savecopy=1 ",
                "parseurl=1",
            });

            var response = RequestToWeb.POST(new Uri("https://www.webtretho.com/forum/private.php?do=insertpm&pmid="), nguoigui.Cookie, data, false, true).ReadStream();
        }
        public void GuiTin(ThongTinTaiKhoan nguoigui, ThongTinTaiKhoan nguoinhan, string tieude, string noidung, Action <string> callback = null)
        {
            if (nguoigui.Cookie == null)
            {
                throw new Exception("Chưa đăng nhập");
            }
            //Gửi tin nhắn
            string guiData = string.Format("idgui={0}&idnhan={1}&tennguoigui={2}&tennguoinhan=AutoSend_{3}&tieude={4}&noidung={5}&btn_submit=GỬI TIN NHẮN",
                                           nguoigui.Id, nguoinhan.Id, nguoigui.TenHienThi, nguoinhan.TenHienThi, tieude, noidung);

            var    guiTinResponse    = RequestToWeb.POST(new Uri("https://henhoketban.vn/guithu.php"), nguoigui.Cookie, guiData, false, true);
            string guiStringResponse = RequestToWeb.ReadStream(guiTinResponse);

            if (guiStringResponse == null)
            {
                nguoigui.ChoPhepGuiNhan = false;
                nguoigui.TrangThai      = "Chuyển tài khoản";
                nguoinhan.TrangThai     = "Gửi lỗi (Web không trả về dữ liệu để xử lý)";
                return;
            }
            if (guiStringResponse.Contains("message.php?guithu=thanhcong"))
            {
                nguoinhan.TrangThai = nguoigui.TaiKhoan;
            }
            else
            {
                nguoinhan.TrangThai = "Gửi lỗi";
            }
        }
        public ActionResult DatHang(FormCollection f)
        {
            HoaDon           ddh = new HoaDon();
            ThongTinTaiKhoan kh  = (ThongTinTaiKhoan)Session["TaiKhoan"];
            List <GioHang>   gh  = LayGioHang();

            ddh.tenTaiKhoan = kh.tenTaiKhoan;
            ddh.ngayBan     = DateTime.Now;
            //var NgayGiao = String.Format("{0:dd/mm/yyyy}", f["NgayGiao"]);
            //ddh.NgayGiao = DateTime.Parse(NgayGiao);
            //ddh.DaThanhToan = "Chưa thanh toán";
            //ddh.TinhTrangGiaoHang = 0;
            db.HoaDons.InsertOnSubmit(ddh);
            db.SubmitChanges();
            //
            foreach (var item in gh)
            {
                ChiTietHoaDon ctdh = new ChiTietHoaDon();
                ctdh.MaHoaDon  = ddh.maHoaDon;
                ctdh.maGiay    = item.imaGiay;
                ctdh.slMua     = item.soluong;
                ctdh.thanhTien = item.dDongia * item.soluong;
                db.ChiTietHoaDons.InsertOnSubmit(ctdh);
            }
            db.SubmitChanges();
            Session["GioHang"] = null;
            return(RedirectToAction("XacNhanDonHang", "GioHang"));
        }
Example #10
0
        public async Task <IActionResult> Edit(int id, [Bind("ThongTinTaiKhoanId,HoVaTen,NgaySinh,Sdt,DiaChi,TaiKhoanId")] ThongTinTaiKhoan thongTinTaiKhoan)
        {
            if (id != thongTinTaiKhoan.ThongTinTaiKhoanId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(thongTinTaiKhoan);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ThongTinTaiKhoanExists(thongTinTaiKhoan.ThongTinTaiKhoanId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TaiKhoanId"] = new SelectList(_context.TaiKhoan, "TaiKhoanId", "Password", thongTinTaiKhoan.TaiKhoanId);
            return(View(thongTinTaiKhoan));
        }
Example #11
0
        public void DangNhap(ref ThongTinTaiKhoan tk)
        {
            string data = string.Format("Email={0}&Password={1}&RememberMe=true&returnUrl=%2F", tk.TaiKhoan, tk.MatKhau);

            var response = RequestToWeb.POST(new Uri("https://henho2.com/Account/Login"), null, data, true);
            var httpRes  = response as HttpWebResponse;

            if (httpRes.StatusCode == HttpStatusCode.Found)
            {
                string setCookie = httpRes.Headers[HttpResponseHeader.SetCookie];
                tk.Cookie = new CookieContainer();
                tk.Cookie.SetCookies(UriTrangWeb.HenHo2, setCookie);
                tk.TrangThai = "Đang nhập thành công";
            }
            else
            {
                tk.TrangThai = "Sai tài khoản hoặc mật khẩu";
                tk.Cookie    = null;
            }

            httpRes.Close();
            httpRes.Dispose();

            response.Close();
            response.Dispose();
        }
Example #12
0
        public async Task <Response <ThongTinTaiKhoan> > TaoTaiKhoan(TaoTaiKhoanRequest request)
        {
            var existsTaiKhoan = _taiKhoanRepo.GetTaiKhoanByUsername(request.Username);

            if (existsTaiKhoan != null)
            {
                return new Response <ThongTinTaiKhoan>
                       {
                           StatusCode = 400,
                           Success    = false,
                           Errors     = new[] { "Tên tài khoản này đã được sử dụng" }
                       }
            }
            ;

            var taiKhoan = new TaiKhoan
            {
                Username     = request.Username,
                MatKhau      = request.MatKhau,
                QuyenTruyCap = request.QuyenTruyCap,
            };
            var newTaiKhoan = await _taiKhoanRepo.CreateTaiKhoan(taiKhoan);

            var data = new ThongTinTaiKhoan(newTaiKhoan);

            return(new Response <ThongTinTaiKhoan>
            {
                StatusCode = 201,
                Success = true,
                Errors = null,
                Data = data
            });
        }
    }
Example #13
0
        public void DangNhap(ref ThongTinTaiKhoan tk)
        {
            tk.Cookie = new CookieContainer();
            var          response = RequestToWeb.GET(new Uri("https://www.ehenho.com/"), false, true, tk.Cookie);
            var          s        = RequestToWeb.ReadStream(response.GetResponseStream());
            HtmlDocument document = new HtmlDocument();

            document.LoadHtml(s);
            var value = document.DocumentNode.SelectSingleNode("//input[@type='hidden' and @name='csrfmiddlewaretoken']").Attributes["value"].Value;

            string data = $"login={tk.TaiKhoan}&password={tk.MatKhau}&remember=on&csrfmiddlewaretoken={value}&remember=on";

            response = RequestToWeb.POST(new Uri("https://www.ehenho.com/accounts/login/"), tk.Cookie, data, true,
                                         config_more: (request) =>
            {
                request.Accept  = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3";
                request.Referer = "https://www.ehenho.com/";
            });
            if ((response as HttpWebResponse)?.StatusCode == HttpStatusCode.Found)
            {
                tk.TrangThai      = "Đang nhập thành công";
                tk.ChoPhepGuiNhan = true;
            }
            else
            {
                tk.TrangThai = "Đăng nhập thất bại";
                tk.Cookie    = null;
            }
        }
Example #14
0
        public static void Test()
        {
            ThongTinTaiKhoan tk = new ThongTinTaiKhoan();

            tk.TaiKhoan = "ngochoaitn";
            tk.MatKhau  = "noongngocj";

            tk.Cookie = new CookieContainer();
            string dangNhap_data = string.Format("username={0}&password={1}&nonxpcookie=1&login=Login&islogin=1",
                                                 tk.TaiKhoan, tk.MatKhau);
            var    dangNhap_Response = RequestToWeb.POST(new Uri("http://www.timbangai.com/timbangai/account/login/"), tk.Cookie, dangNhap_data, false);
            string dangNhap_string   = RequestToWeb.ReadStream(dangNhap_Response);
            var    dangNhap_Header   = RequestToWeb.ReadHeader(dangNhap_Response.Headers);

            if (dangNhap_string == "")
            {
                tk.TrangThai = "Đang nhập thành công";
            }
            else
            {
                tk.TrangThai = "Sai tài khoản hoặc mật khẩu";
            }


            //Gửi thư
            ThongTinTaiKhoan nguoigui  = tk;
            ThongTinTaiKhoan nguoinhan = new ThongTinTaiKhoan()
            {
                TenHienThi = "asbirine", Url = "http://www.timbangai.com/timbangai/asbirine"
            };

            if (string.IsNullOrEmpty(tk.Id))
            {
                //Lấy thông tin tài khoản nhận thư
                var    thongTinNguoiNhanThu_Response  = RequestToWeb.GET(new Uri(nguoinhan.Url), false);
                string thongTinNguoiNhanThu_string    = RequestToWeb.ReadStream(thongTinNguoiNhanThu_Response);
                HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
                document.LoadHtml(thongTinNguoiNhanThu_string);
                var    thongTinNguoiNhanThu_message = document.DocumentNode.Descendants("li").Where(div => div.HasClass("message")).FirstOrDefault();
                string thongTinNguoiNhanThu_Url     = thongTinNguoiNhanThu_message.QuerySelector("a").GetAttributeValue("href", "");
                nguoinhan.Id = thongTinNguoiNhanThu_Url.Split('/')[7];
            }
            string noidung         = "Nội dung tự động";
            string chude           = "chủ đề tự động";
            string guiThu_data     = string.Format("subject={0}&body={1}&submit=Gởi&ismessage=1", chude, noidung);
            var    guiThu_Response = RequestToWeb.POST(new Uri(string.Format("http://www.timbangai.com/timbangai/account/messages/compose/{0}", nguoinhan.Id)), nguoigui.Cookie, guiThu_data, false);
            string guiThu_string   = RequestToWeb.ReadStream(guiThu_Response);

            if (guiThu_string == "")
            {
                nguoinhan.TrangThai = tk.TaiKhoan;
            }
            else
            {
                nguoinhan.TrangThai = "Gửi lỗi";
            }
        }
Example #15
0
        public void GuiTin(ThongTinTaiKhoan nguoigui, ThongTinTaiKhoan nguoinhan, string tieude, string noidung, Action <string> callback = null)
        {
            if (nguoigui.Cookie == null)
            {
                throw new Exception("Thiếu cookie");
            }

            string data = string.Format("IdTo={0}&NameTo={1}&Title={2}&MessageContent={3}", nguoinhan.Id, nguoinhan.TenHienThi, tieude, noidung);

            var response = RequestToWeb.POST(new Uri("https://henho2.com/Message/Create"), nguoigui.Cookie, data, false, true);

            nguoinhan.TrangThai = nguoigui.TaiKhoan;
            using (var sr = new StreamReader(response.GetResponseStream()))
            {
                string stringResponse = sr.ReadToEnd();
                if (stringResponse == null)
                {
                    nguoigui.TrangThai      = "Chuyển tài khoản";
                    nguoigui.ChoPhepGuiNhan = false;
                    nguoinhan.TrangThai     = "Gửi lỗi (Web không trả về dữ liệu để xử lý)";
                }
                if (stringResponse != null && !stringResponse.Contains("Gửi tin nhắn th&#224;nh c&#244;ng"))
                {
                    if (stringResponse.Contains("gửi qu&#225; số thư cho ph&#233;p"))
                    {
                        nguoinhan.TrangThai     = "Gửi lỗi\n(quá số thư cho phép)";
                        nguoigui.TrangThai      = "Quá số thư cho phép";
                        nguoigui.ChoPhepGuiNhan = false;
                    }
                    else if (stringResponse.Contains("Vui l&#242;ng nhập từ"))
                    {
                        nguoinhan.TrangThai = "Gửi lỗi\n(quá ngắn)";
                    }
                    else if (stringResponse.Contains("Chưa kích hoạt"))
                    {
                        nguoigui.TrangThai      = nguoinhan.TrangThai = "Chưa kích hoạt";
                        nguoigui.ChoPhepGuiNhan = false;
                    }
                    else if (stringResponse.Contains("Bạn đ&#227; bị ban"))
                    {
                        nguoigui.TrangThai = nguoinhan.TrangThai = "Gửi lỗi\n(tài khoản bị khóa)";
                        if (callback != null)
                        {
                            callback(CONST_HENHO2.TAI_KHOAN_BI_KHOA);
                        }
                        nguoigui.ChoPhepGuiNhan = false;
                    }
                    else
                    {
                        nguoigui.TrangThai      = nguoinhan.TrangThai = "Gửi lỗi\n(nhập lại tài khoản)";
                        nguoigui.ChoPhepGuiNhan = false;
                    }
                }
            }
        }
        public static void Test()
        {
            #region Đang nhập, gửi tin
            ThongTinTaiKhoan tk = new ThongTinTaiKhoan();
            tk.Cookie   = new CookieContainer();
            tk.TaiKhoan = "ngochoaitn";
            tk.MatKhau  = "noongngocj";

            string dangNhapData           = string.Format("username={0}&password={1}&btn_submit=ĐĂNG NHẬP", tk.TaiKhoan, tk.MatKhau);
            var    dangNhapResponse       = RequestToWeb.POST(new Uri("https://henhoketban.vn/login.php"), tk.Cookie, dangNhapData, false);
            string dangNhapStringResponse = RequestToWeb.ReadStream(dangNhapResponse);
            var    dangNhapHeader         = RequestToWeb.ReadHeader(dangNhapResponse.Headers);
            if (dangNhapStringResponse.Contains("ĐĂNG NHẬP THÀNH CÔNG"))
            {
                //Đi lấy thông tin tài khoản
                var    layThongTinResponse       = RequestToWeb.GET(new Uri("https://henhoketban.vn/index.php"), false, false, tk.Cookie);
                string layThongTinStringResponse = RequestToWeb.ReadStream(layThongTinResponse);

                HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
                document.LoadHtml(layThongTinStringResponse);

                string duongDan = document.DocumentNode.QuerySelectorAll("div#top > div > div > font > a").FirstOrDefault().GetAttributeValue("href", "");
                tk.Id = duongDan.Split('=')[1];

                //Lấy tên hiển thị
                var    tenHienThiResponse       = RequestToWeb.GET(new Uri(duongDan), false);
                string tenHienThiStringResponse = RequestToWeb.ReadStream(tenHienThiResponse);
                document.LoadHtml(tenHienThiStringResponse);
                tk.TenHienThi = document.DocumentNode.QuerySelector("h1 > font").InnerText.Split('|')[1].Trim();


                //Gửi tin nhắn
                ThongTinTaiKhoan tknhan = new ThongTinTaiKhoan()
                {
                    Id = "10454", TenHienThi = "Lan"
                };
                string tieuDe  = "Tiêu đề xxxxxxxx";
                string noidung = "Nội dung xxxxxxxxx";

                string guiData = string.Format("idgui={0}&idnhan={1}&tennguoigui={2}&tennguoinhan=AutoSend->{3}&tieude={4}&noidung={5}&btn_submit=GỬI TIN NHẮN",
                                               tk.Id, tknhan.Id, tk.TenHienThi, tknhan.TenHienThi, tieuDe, noidung);
                var    guiTinResponse    = RequestToWeb.POST(new Uri("https://henhoketban.vn/guithu.php"), tk.Cookie, guiData, false);
                string guiStringResponse = RequestToWeb.ReadStream(guiTinResponse);
                if (guiStringResponse.Contains("GỬI TIN NHẮN THÀNH CÔNG."))
                {
                    tknhan.TrangThai = tk.TaiKhoan;
                }
                else
                {
                    tknhan.TrangThai = "Gửi lỗi";
                }
            }
            #endregion
        }
Example #17
0
        public IActionResult ChangeInfo()
        {
            var user     = HttpContext.Session.GetString("User");
            var taikhoan = _context.ThongTinTaiKhoan.Include(p => p.TaiKhoan).Where(p => p.TaiKhoan.UserName == user).FirstOrDefault();

            if (taikhoan == null)
            {
                taikhoan = new ThongTinTaiKhoan();
            }
            return(View(taikhoan));
        }
Example #18
0
        private void xóaLỗiHàngĐangChọnToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ThongTinTaiKhoan tk = thongTinTaiKhoan_TimKiemBindingSource.Current as ThongTinTaiKhoan;

            if (tk != null && !string.IsNullOrEmpty(tk.TrangThai) && tk.TrangThai.Contains("lỗi"))
            {
                tk.TrangThai = "";
            }
            thongTinTaiKhoan_TimKiemBindingSource.EndEdit();
            grbTimKiem.Refresh();
        }
Example #19
0
        private void grvGui_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            ThongTinTaiKhoan tk = thongTinTaiKhoan_GuiBindingSource.Current as ThongTinTaiKhoan;

            if (tk != null)
            {
                tk.Cookie    = null;
                tk.TrangThai = "";
                thongTinTaiKhoan_GuiBindingSource.EndEdit();
                grvGui.Refresh();
            }
        }
Example #20
0
        public async Task <IActionResult> Create([Bind("ThongTinTaiKhoanId,HoVaTen,NgaySinh,Sdt,DiaChi,TaiKhoanId")] ThongTinTaiKhoan thongTinTaiKhoan)
        {
            if (ModelState.IsValid)
            {
                _context.Add(thongTinTaiKhoan);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TaiKhoanId"] = new SelectList(_context.TaiKhoan, "TaiKhoanId", "UserName", thongTinTaiKhoan.TaiKhoanId);
            return(View(thongTinTaiKhoan));
        }
Example #21
0
        private async void đăngNhậpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ThongTinTaiKhoan tk = thongTinTaiKhoan_GuiBindingSource.Current as ThongTinTaiKhoan;

            if (tk != null)
            {
                đăngNhậpToolStripMenuItem.Enabled = false;
                await tk.DangNhapAsync(_guiTinNhan);

                đăngNhậpToolStripMenuItem.Enabled = true;
            }
        }
Example #22
0
        private void btnThongTin_Click(object sender, EventArgs e)
        {
            ClearRenderbody();
            ThongTinTaiKhoan thongTinTaiKhoan = new ThongTinTaiKhoan(taiKhoan);

            thongTinTaiKhoan.TopLevel = false;
            thongTinTaiKhoan.Width    = pnlBody.Width;
            thongTinTaiKhoan.Height   = pnlBody.Height;
            thongTinTaiKhoan.Anchor   = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
            pnlBody.Controls.Add(thongTinTaiKhoan);
            thongTinTaiKhoan.Show();
        }
Example #23
0
        private void thongTinTaiKhoan_TimKiemBindingSource_PositionChanged(object sender, EventArgs e)
        {
            ThongTinTaiKhoan tk = thongTinTaiKhoan_TimKiemBindingSource.Current as ThongTinTaiKhoan;

            if (tk != null && !string.IsNullOrEmpty(tk.TrangThai) && tk.TrangThai.Contains("lỗi"))
            {
                xóaLỗiHàngĐangChọnToolStripMenuItem.Enabled = true;
            }
            else
            {
                xóaLỗiHàngĐangChọnToolStripMenuItem.Enabled = false;
            }
        }
        public void GuiTin(ThongTinTaiKhoan nguoigui, ThongTinTaiKhoan nguoinhan, string tieude, string noidung, Action <string> callback = null)
        {
            if (nguoigui.Cookie == null)
            {
                throw new Exception("Thiếu cookie");
            }

            string data = string.Format("cmd=send_message&user_to={0}&msg={1}&to_delete=0", nguoinhan.Id, noidung);

            var response = RequestToWeb.POST(new Uri("http://duyenso.com/ajax.php"), nguoigui.Cookie, data, false);

            if (response == null)
            {
                nguoinhan.TrangThai = "Gửi lỗi (Time out)";
                return;
            }

            nguoinhan.TrangThai = nguoigui.TaiKhoan;
            using (var sr = new StreamReader(response.GetResponseStream()))
            {
                string stringResponse = sr.ReadToEnd();
                if (stringResponse == null)
                {
                    nguoigui.ChoPhepGuiNhan = false;
                    nguoigui.TrangThai      = "Chuyển tài khoản";
                    nguoinhan.TrangThai     = "Gửi lỗi (Web không trả về dữ liệu để xử lý)";
                    return;
                }
                if (stringResponse != null && !stringResponse.Contains("ERROR") && !stringResponse.Contains("Error"))
                {
                    if (stringResponse.Contains("VIP"))
                    {
                        nguoinhan.TrangThai = "Thất bại (Cần VIP)";
                    }
                }
                else
                {
                    nguoinhan.TrangThai = "Gửi lỗi (Server)";
                }

                if (stringResponse != null)
                {
                    var    dataResponse = stringResponse.Split('"');
                    string senderId     = dataResponse[6].Trim();

                    string dataUpdate = string.Format("cmd=pp_messages&user_id={0}&is_mode_fb=false", nguoinhan.Id);

                    var resUpdate = RequestToWeb.POST(new Uri("http://duyenso.com/ajax.php"), nguoigui.Cookie, dataUpdate, true);
                }
            }
        }
        public void DangNhap(ref ThongTinTaiKhoan tk)
        {
            HttpWebRequest request = WebRequest.CreateHttp("http://duyenso.com/ajax.php");

            request.ContentType       = "application/x-www-form-urlencoded";
            request.AllowAutoRedirect = false;
            request.Method            = "POST";

            StreamWriter sw = new StreamWriter(request.GetRequestStream());

            sw.Write(string.Format("cmd=login&user={0}&password={1}&remember=1", tk.TaiKhoan, tk.MatKhau));
            sw.Close();

            var response = request.GetResponse();
            var httpRes  = response as HttpWebResponse;

            //string stringResponse =
            using (StreamReader sr = new StreamReader(response.GetResponseStream()))
            {
                string stringResponse = sr.ReadToEnd();
                if (stringResponse == "profile_view.php")
                {
                    string setCookie = httpRes.Headers[HttpResponseHeader.SetCookie];
                    tk.Cookie = new CookieContainer();
                    tk.Cookie.SetCookies(UriTrangWeb.DuyenSo, setCookie);
                    tk.TrangThai      = "Đang nhập thành công";
                    tk.ChoPhepGuiNhan = true;
                }
                else
                {
                    if (stringResponse.Contains("Không thể đăng nhập lúc này. Xin thử lại sau "))
                    {
                        tk.TrangThai = "Bị khóa (Thử lại sau)";
                    }
                    else
                    {
                        tk.TrangThai = "Sai tài khoản hoặc mật khẩu";
                    }
                    tk.Cookie = null;
                }
            }
            sw.Dispose();
            request.Abort();

            httpRes.Close();
            httpRes.Dispose();

            response.Close();
            response.Dispose();
        }
        public ActionResult ttNguoiDung()
        {
            ThongTinTaiKhoan lstND = Session["TaiKhoan"] as ThongTinTaiKhoan;

            if (lstND == null)
            {
                // neu lstgiohang chua ton tai  thi khoi tao
                lstND = new ThongTinTaiKhoan();
                Session["TaiKhoan"] = lstND;
                return(RedirectToAction("DangNhap", "NguoiDung"));
            }
            else
            {
                return(View(lstND));
            }
        }
Example #27
0
        private void càiĐạtSLGửiTheoTàiKhoảnNàyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ThongTinTaiKhoan taiKhoan = thongTinTaiKhoan_GuiBindingSource.Current as ThongTinTaiKhoan;

            if (taiKhoan != null)
            {
                foreach (ThongTinTaiKhoan tk in thongTinTaiKhoan_GuiBindingSource)
                {
                    tk.SoThuSeGui = taiKhoan.SoThuSeGui;
                }
                thongTinTaiKhoan_GuiBindingSource.EndEdit();
                grvGui.Refresh();
            }
            else
            {
                MessageBox.Show("Chưa chọn tài khoản");
            }
        }
Example #28
0
        public void DangNhap(ref ThongTinTaiKhoan tk)
        {
            tk.Cookie = new CookieContainer();
            string dangNhap_data = string.Format("username={0}&password={1}&nonxpcookie=1&login=Login&islogin=1",
                                                 tk.TaiKhoan, tk.MatKhau);
            var    dangNhap_Response = RequestToWeb.POST(new Uri("http://www.timbangai.com/timbangai/account/login/"), tk.Cookie, dangNhap_data, false);
            string dangNhap_string   = RequestToWeb.ReadStream(dangNhap_Response);
            var    dangNhap_Header   = RequestToWeb.ReadHeader(dangNhap_Response.Headers);

            if (dangNhap_string == "")
            {
                tk.TrangThai      = "Đang nhập thành công";
                tk.ChoPhepGuiNhan = true;
            }
            else
            {
                tk.TrangThai = "Sai tài khoản hoặc mật khẩu";
            }
        }
Example #29
0
        private void FrMain_Load(object sender, EventArgs e)
        {
            chart = new DanhGiaNangLuc();
            ////THHT = new TinhHinhHocTap();

            QLMH   = new QuanLyMonHoc();
            DiemSV = new DiemSinhVien();
            QLK    = new QuanLyKhoa();
            QLLH   = new QuanLyLopHoc();
            TTSV   = new ThongTinSinhVien();
            DMK    = new DoiMatKhau(account);
            TTTK   = new ThongTinTaiKhoan(account, DMK);
            inf    = new information();
            QLND   = new QuanLyNguoiDung();
            SLSVTK = new SoLuongSinhVienTheoKhoa();
            this.pnlDisplay.Controls.Add(SLSVTK);


            this.pnlDisplay.Controls.Add(QLND);

            this.pnlDisplay.Controls.Add(QLMH);
            this.pnlDisplay.Controls.Add(DiemSV);
            this.pnlDisplay.Controls.Add(QLK);
            this.pnlDisplay.Controls.Add(QLLH);
            this.pnlDisplay.Controls.Add(TTSV);
            this.pnlDisplay.Controls.Add(TTTK);
            this.pnlDisplay.Controls.Add(inf);
            this.pnlDisplay.Controls.Add(DMK);
            this.pnlDisplay.Controls.Add(chart);

            this.SLSVTK.Visible = false;
            this.chart.Visible  = false;
            this.QLND.Visible   = false;
            this.DiemSV.Visible = false;

            this.QLMH.Visible = false;
            this.QLK.Visible  = false;
            this.QLLH.Visible = false;
            this.TTSV.Visible = false;
            this.DMK.Visible  = false;
            this.TTTK.Visible = false;
            this.inf.Visible  = false;
        }
        public async Task DangNhapAsync(ThongTinTaiKhoan tk)
        {
            string data = string.Join("&", new[]
            {
                "do=login",
                "vb_login_md5password="******"vb_login_md5password_utf=",
                "s=",
                "securitytoken=guest",
                $"vb_login_username={tk.TaiKhoan}",
                $"vb_login_password={tk.MatKhau}",
            });

            tk.Cookie = new CookieContainer();
            //var html2 = (await RequestToWeb.GETAsync(new Uri("https://www.webtretho.com/forum/login.php?do=login"), false, true, tk.Cookie)).ReadStream();
            var response = await RequestToWeb.POSTAsync(new Uri("https://www.webtretho.com/forum/login.php?do=login"), tk.Cookie, data, false);

            //var response = RequestToWeb.POST(new Uri("https://www.webtretho.com/forum/login.php?do=login"), tk.Cookie, data, false);
            var    httpRes = response as HttpWebResponse;
            string html    = response.ReadStream();

            if (!html?.Contains("Bạn đã cố gắng đăng nhập hết") ?? true)
            {
                var    test      = tk.Cookie.GetAllCookies();
                string setCookie = httpRes.Headers[HttpResponseHeader.SetCookie];
                Debug.WriteLine(setCookie);
                //tk.Cookie = new CookieContainer();
                //tk.Cookie.SetCookies(UriTrangWeb.WEBTRETHO, setCookie);
                tk.TrangThai = "Đăng nhập thành công";
            }
            else
            {
                tk.TrangThai = "Đăng nhập thất bại";
                tk.Cookie    = null;
            }

            httpRes.Close();
            httpRes.Dispose();

            response.Close();
            response.Dispose();
        }
        private void LoadData()
        {

            List<TaiKhoan> _taiKhoan = new List<TaiKhoan>();
            TaiKhoanBUS _busTaiKhoan = new TaiKhoanBUS();

            _taiKhoan = _busTaiKhoan.GetList();

            dataGrid.Items.Clear();

            foreach (TaiKhoan i in _taiKhoan)
            {
                ThongTinTaiKhoan _thongTinTaiKhoan = new ThongTinTaiKhoan();
                _thongTinTaiKhoan.TenDangNhap = i.TenDangNhap;
                _thongTinTaiKhoan.MatKhau = i.MatKhau;

                dataGrid.IsReadOnly = true;
                dataGrid.Items.Add(_thongTinTaiKhoan);
            }
        }