コード例 #1
0
        public void ProcessRequest(HttpContext context)
        {
            string msg = string.Empty;

            try
            {
                string userName = WebBase.GetFormString("txtusername", string.Empty);
                string userPwd  = WebBase.GetFormString("txtpassword", string.Empty);
                string ip       = WebBase.GetFormString("ip", ServerVariables.TrueIP);

                if (string.IsNullOrEmpty(userName))
                {
                    msg = ("请输入商户名!");
                }
                else if (string.IsNullOrEmpty(userPwd))
                {
                    msg = ("请输入商户密码!");
                }
                else
                {
                    msg = viviapi.BLL.User.Login.SignIn(1, 0, userName, Cryptography.MD5(userPwd), ip, ip);

                    if (msg == "success")
                    {
                        msg = "success," + HttpContext.Current.Session[viviapi.BLL.User.Login.UserLoginSessionid].ToString();
                    }
                }
            }
            catch
            {
                msg = "login fail";
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(msg);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parmName"></param>
        /// <returns></returns>
        public string GetParmValue(string parmName)
        {
            string parmValue = WebBase.GetQueryStringString(parmName, "");

            if (string.IsNullOrEmpty(parmValue))
            {
                parmValue = WebBase.GetFormString(parmName, "");
            }
            return(parmValue);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: garycheng45/Fund
 static void TestCrawler()
 {
     WebBase a    = new WebBase();
     string  html = a.temp();
     //a.SetURL("http://fund.bot.com.tw/w/wb/wb02a.djhtm?customershowall=0&a=TLZ64-0532");
     //string html = a.GetHtmlContent();
     //string html = File.ReadAllText(testFilePath);
     IFundCrawler craw = new FundRich();
     var          obj  = craw.ParseFund(html);
 }
コード例 #4
0
        public void ProcessRequest(HttpContext context)
        {
            string url = HttpUtility.UrlDecode(WebBase.GetQueryStringString("url", string.Empty));

            if (!string.IsNullOrEmpty(url))
            {
                url = viviLib.Security.Cryptography.DecryptConnString(url).Replace("\0", "");

                ShowImage(url);
            }

            //context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");
        }
コード例 #5
0
        public void ProcessRequest(HttpContext context)
        {
            string url     = "";
            string message = "未知错误";

            try
            {
                string orderid = WebBase.GetQueryStringString("oid", "");

                if (!string.IsNullOrEmpty(orderid))
                {
                    var info = Factory.Instance.GetModelByOrderId(orderid);
                    if (info == null)
                    {
                        message = "不存在此订单";
                    }
                    else
                    {
                        if (info.status == 1)
                        {
                            message = "未完成支付";
                        }
                        else
                        {
                            url = viviapi.SysInterface.Bank.Utility.GetReturnUrl(info);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }

            var result = new QueryOrderResult {
                msg = message, url = url
            };
            string text = Newtonsoft.Json.JsonConvert.SerializeObject(result, Newtonsoft.Json.Formatting.Indented);

            context.Response.ContentType = "application/json";
            context.Response.Write(text);
        }
コード例 #6
0
        /// <summary>
        /// 根據設定將進行資料爬蟲
        /// </summary>
        public void DoCrawer()
        {
            WebBase wb = new WebBase();

            foreach (var nd in _NotifyData)
            {
                wb.SetURL(nd.Url);
                string html = wb.GetHtmlContent(nd.Url);
                if (nd.NotifyType == Enum.DBEnum.NotifyType.Fund)
                {
                    IFundCrawler crawer    = CrawlerCreateFactory.CreateFundCrawler(nd.Resource);
                    var          fundDatas = crawer.ParseFund(html);
                    if (fundDatas.Count == 0)
                    {
                        continue;
                    }
                    var crd = ConvertFundDataToCrawerData(fundDatas, nd.Name);
                    _CrawlerData.Add(crd);
                }
            }
        }
コード例 #7
0
        public void ProcessRequest(HttpContext context)
        {
            string callback = "";

            try
            {
                string cacheKey = WebBase.GetQueryStringString("cacheKey", "");
                string passKey  = WebBase.GetQueryStringString("passKey", "");

                //键值是否有效
                if (string.IsNullOrEmpty(cacheKey))
                {
                    callback = ("CacheKey is not null!");
                }

                //对传递的参数进行有效性检查
                if (passKey != viviLib.Security.Cryptography.MD5(cacheKey + viviapi.SysConfig.MemCachedConfig.AuthCode))
                {
                    callback = ("AuthCode is not valid!");
                }


                if (string.IsNullOrEmpty(callback))
                {
                    WebCache.LoadCacheStrategy(new DefaultCacheStrategy());
                    WebCache.GetCacheService().RemoveObject(cacheKey);
                    WebCache.LoadDefaultCacheStrategy();
                }


                callback = "OK";
            }
            catch (Exception)
            {
                callback = "Error";
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(callback);
        }
コード例 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int    userid    = WebBase.GetQueryStringInt32("u", 0);
            int    manageid  = WebBase.GetQueryStringInt32("m", 0);
            string sessionId = WebBase.GetQueryStringString("key", "");
            string sign      = WebBase.GetQueryStringString("sign", "");

            string plain = string.Format("{0}|{1}|{2}{3}", userid, manageid,
                                         sessionId, viviapi.BLL.Sys.Constant.ManageGOTOUserAdminKey);


            string sign2 = viviLib.Security.Cryptography.MD5(plain);

            if (sign == sign2)
            {
                int manageid2 = viviapi.BLL.ManageFactory.GetIdBySession(sessionId);
                if (manageid == manageid2)
                {
                    HttpContext.Current.Session[viviapi.BLL.Sys.Constant.ManageGOTOUserAdminKey] = userid;

                    Response.Redirect("/usermodule/account/index.aspx");
                }
            }
        }
コード例 #9
0
        public string SignIn()
        {
            string message = "";

            try
            {
                string userName = WebBase.GetFormString("username", "");
                string userPwd  = WebBase.GetFormString("password", "");
                string ispass   = WebBase.GetFormString("ckbsavepass", "");
                string code     = WebBase.GetFormString("imycode", "");

                if (string.IsNullOrEmpty(code))
                {
                    message = ("请输入验证码!");
                }
                else if (string.IsNullOrEmpty(userName))
                {
                    message = ("请输入商户名!");
                }
                else if (string.IsNullOrEmpty(userPwd))
                {
                    message = ("请输入商户密码!");
                }
                else
                {
                    message = WebUtility.CheckValiDateCode(code);
                }

                if (string.IsNullOrEmpty(message))
                {
                    string lastLoginIp      = ServerVariables.TrueIP;
                    string lastLoginAddress = WebUtility.GetIPAddress(lastLoginIp);

                    message = viviapi.BLL.User.Login.SignIn(0, 0, userName, Cryptography.MD5(userPwd), lastLoginIp, lastLoginAddress);

                    if (message == "success")
                    {
                        if (ispass != null)
                        {
                            HttpCookie hc = new HttpCookie("yklm_user");
                            DateTime   dt = DateTime.Now;
                            TimeSpan   ts = new TimeSpan(90, 0, 0, 0, 0); //过期时间为1分钟
                            hc.Expires = dt.Add(ts);                      //设置过期时间

                            //hc.Values.Add("username", userName);
                            hc.Values.Add("userpass", Cryptography.MD5(userPwd));
                            Response.AppendCookie(hc);
                        }
                        else
                        {
                            HttpCookie hc = new HttpCookie("yklm_user");
                            hc.Expires = DateTime.Now.AddMonths(-24);
                            Response.Cookies.Add(hc);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ExceptionHandler.HandleException(exception);
                message = exception.Message;
            }

            return(message);
        }
コード例 #10
0
 protected void PagerNavication_PagerIndexChanged(object sender, WebBase.UserControls.PagerIndexChagedEventArgs e)
 {
     _BindData();
 }
コード例 #11
0
        private void SignIn()
        {
            string message = "";

            string userName   = XRequest.GetString("username");
            string passWord   = XRequest.GetString("password");
            string code       = XRequest.GetString("CCode");
            string RememberMe = WebBase.GetFormString("RememberMe", "");

            if (string.IsNullOrEmpty(code))
            {
                message = ("请输入验证码!");
            }
            else if (string.IsNullOrEmpty(userName))
            {
                message = ("请输入代理账号!");
            }
            else if (string.IsNullOrEmpty(passWord))
            {
                message = ("请输入代理密码!");
            }
            else
            {
                message = WebUtility.CheckValiDateCode(code);
            }

            if (string.IsNullOrEmpty(message))
            {
                string lastLoginIp      = ServerVariables.TrueIP;
                string lastLoginAddress = WebUtility.GetIPAddress(lastLoginIp);

                message = viviapi.BLL.User.Login.SignIn(0, 1, userName, Cryptography.MD5(passWord), lastLoginIp,
                                                        lastLoginAddress);

                if (message == "success")
                {
                    if (viviapi.BLL.User.Login.CurrentMember.UserType == UserTypeEnum.代理)
                    {
                        if (RememberMe != null)
                        {
                            HttpCookie hc = new HttpCookie("yklm_agent");
                            DateTime   dt = DateTime.Now;
                            TimeSpan   ts = new TimeSpan(90, 0, 0, 0, 0); //过期时间为1分钟
                            hc.Expires = dt.Add(ts);                      //设置过期时间

                            hc.Values.Add("username", userName);

                            Response.AppendCookie(hc);
                        }
                        else
                        {
                            HttpCookie hc = new HttpCookie("yklm_agent");
                            hc.Expires = DateTime.Now.AddMonths(-24);
                            Response.Cookies.Add(hc);
                        }
                    }
                    else
                    {
                        message = ("非代理权限,无法登录!");
                    }
                }
            }

            if (message == "success")
            {
                Response.Redirect("main.aspx");
            }
            else
            {
                ShowMessageBox(message);
            }
        }
コード例 #12
0
 public string GetValue(string key)
 {
     return(WebBase.GetFormString(key, ""));
 }
コード例 #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.Cookies["yklm_admin"] != null)
                {
                    //UserNameBox.Value = Request.Cookies["yklm_admin"]["username"].ToString();
                    //password.Attributes["value"] = "**********";
                }
            }

            if (XRequest.IsPost())
            {
                string code   = XRequest.GetString("CCode").ToUpper();
                string secode = this.Session["CCode"].ToString().ToUpper();
                if (this.Session["CCode"] == null)
                {
                    AlertAndRedirect("验证码已失效!");
                    return;
                }
                else if (XRequest.GetString("CCode").ToUpper() != this.Session["CCode"].ToString().ToUpper())
                {
                    AlertAndRedirect("验证码错误!");
                    return;
                }
                else
                {
                    string userName   = XRequest.GetString("UserNameBox");
                    string passWord   = Cryptography.MD5(XRequest.GetString("pas"));
                    string RememberMe = WebBase.GetFormString("RememberMe", "");

                    Model.Manage manage = new viviapi.Model.Manage();
                    manage.username         = userName;
                    manage.password         = passWord;
                    manage.lastLoginTime    = DateTime.Now;
                    manage.lastLoginIp      = viviLib.Web.ServerVariables.TrueIP;
                    manage.LastLoginAddress = WebUtility.GetIPAddress(manage.lastLoginIp);
                    manage.LastLoginRemark  = WebUtility.GetIPAddressInfo(manage.lastLoginIp);

                    string message = BLL.ManageFactory.SignIn(manage);

                    if (manage.id > 0)
                    {
                        if (RememberMe != null)
                        {
                            HttpCookie hc = new HttpCookie("yklm_admin");
                            DateTime   dt = DateTime.Now;
                            TimeSpan   ts = new TimeSpan(90, 0, 0, 0, 0); //过期时间为1分钟
                            hc.Expires = dt.Add(ts);                      //设置过期时间

                            hc.Values.Add("username", userName);

                            Response.AppendCookie(hc);
                        }
                        else
                        {
                            HttpCookie hc = new HttpCookie("yklm_admin");
                            hc.Expires = DateTime.Now.AddMonths(-24);
                            Response.Cookies.Add(hc);
                        }

                        AlertAndRedirect(string.Empty, "main.aspx");
                    }
                    else
                    {
                        AlertAndRedirect(message);
                    }
                }
            }
        }
コード例 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool success = false;

            string bankcode = "";
            int    suppid   = 0;

            try
            {
                userid   = Request.QueryString["userid"];
                suppid   = WebBase.GetQueryStringInt32("suppid", 0);
                orderid  = Request.QueryString["orderid"];
                orderAmt = Request.QueryString["orderAmt"];
                bankcode = Request.QueryString["bankcode"];
                string time = Request.QueryString["time"];
                string sign = Request.QueryString["sign"];

                //hforderid.Value = orderid;

                #region

                if (!string.IsNullOrEmpty(userid) && !string.IsNullOrEmpty(time))
                {
                    int intUserid = 0;

                    if (int.TryParse(userid, out intUserid))
                    {
                        var userinfo = viviapi.BLL.User.Factory.GetCacheUserBaseInfo(intUserid);

                        if (userinfo != null)
                        {
                            string thisSign =
                                string.Format(
                                    "userid={0}&suppid={1}&orderid={2}&orderAmt={3}&bankcode={4}&time={5}{6}"
                                    , userid
                                    , suppid
                                    , orderid
                                    , orderAmt
                                    , bankcode
                                    , time
                                    , userinfo.APIKey);

                            thisSign = viviLib.Security.Cryptography.MD5(thisSign);

                            if (thisSign == sign)
                            {
                                success = true;
                            }
                        }
                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex);
                Response.Write("error");
                Response.End();
            }

            if (success)
            {
                Getqrcode_img_url(suppid, orderid, decimal.Parse(orderAmt), bankcode);
            }
        }
コード例 #15
0
 public string GetRootPath()
 {
     return(WebBase.GetRootPath());
 }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string message  = "";
            string userName = WebBase.GetFormString("username", "");
            string userPwd  = WebBase.GetFormString("password", "");

            string code = WebBase.GetFormString("login_yzcode", "");

            if (string.IsNullOrEmpty(userName))
            {
                message = ("请输入用户名!");
            }
            else if (string.IsNullOrEmpty(userPwd))
            {
                message = ("请输入密码!");
            }


            if (string.IsNullOrEmpty(message))
            {
                if (viviLib.Text.PageValidate.IsEmail(userName))
                {
                    if (!RegisterSettings.AllowUserloginByEmail)
                    {
                        message = ("平台不允许通过邮箱登录!");
                    }
                }
                else if (viviLib.Text.PageValidate.IsMobile(userName))
                {
                    if (!RegisterSettings.AllowUserloginByPhone)
                    {
                        message = ("平台不允许通过手机号码登录!");
                    }
                }
            }

            if (string.IsNullOrEmpty(message))
            {
                string lastLoginIp      = ServerVariables.TrueIP;
                string lastLoginAddress = WebUtility.GetIPAddress(lastLoginIp);

                message = viviapi.BLL.User.Login.SignIn(0, 0, userName, Cryptography.MD5(userPwd), lastLoginIp, lastLoginAddress);

                if (message == "success")
                {
                    HttpCookie hc = new HttpCookie("yklm_user");
                    DateTime   dt = DateTime.Now;
                    TimeSpan   ts = new TimeSpan(90, 0, 0, 0, 0); //过期时间为1分钟
                    hc.Expires = dt.Add(ts);                      //设置过期时间

                    hc.Values.Add("username", userName);
                    hc.Values.Add("userpass", Cryptography.MD5(userPwd));
                    HttpContext.Current.Response.AppendCookie(hc);
                    string response = "{\"code\":200,\"error_num\":0}";
                    Response.Write(response);
                }
                else
                {
                    string response = "{\"code\":0,\"data\":{\"error_messages\":{\"result\":\"error2\"}},\"error_num\":0}";
                    Response.Write(response);
                }
            }
            else
            {
                Response.Write("{\"code\":0,\"data\":{\"error_messages\":{\"result\":\"error\"}},\"error_num\":0}");
            }
        }