public Login() { string app = gform("app"); if (!string.IsNullOrEmpty(gform("backurl"))) { setCookie("backurl", gform("backurl")); } if (app == "loginout") { PassportBll bll = new PassportBll(); bll.loginout(); HttpContext.Current.Response.Redirect(HttpContext.Current.Request.UrlReferrer.ToString()); } if (ISPOST) { PassportBll bll = new PassportBll(); if (bll.login(pform("username"), pform("password"))) { string url = HttpContext.Current.Request.UrlReferrer.ToString(); if (!string.IsNullOrEmpty(getCookie("backurl"))) { url = getCookie("backurl"); setCookie("backurl", ""); } die("<script type=\"text/javascript\">alert('登陆成功');location.href='"+url+"'</script>"); } else { err_text = "用户名和密码错误"; } } }
public Register() { WebConf conf = new WebConf(); if (conf.getVal("userreg") == "1") { showMessage("注册功能已经关闭"); } if (ISPOST) { MemberInfo info = new MemberInfo(); info.username = pform("username"); if (info.username == "") { showMessage("用户名不能为空","javascript:history.back();"); return; } info.password = pform("pwd"); if (info.password != pform("repwd")) { showMessage("两次输入的密码不同", "javascript:history.back();"); return; } if (pform("sex") == "1") info.sex = true; else info.sex = false; info.truename = pform("truename"); info.email = pform("email"); if (info.email == "") { showMessage("email不能为空", "javascript:history.back();"); return; } info.telphone = pform("telphone"); info.mobile = pform("mobile"); info.qq = pform("qq"); info.birth = pform("birth"); info.ip = "ip"; info.address = pform("address"); PassportBll pb = new PassportBll(); if (pb.register(info)) { string url = HttpContext.Current.Request.UrlReferrer.ToString(); die("<script type=\"text/javascript\">alert('注册成功');location.href='" + url + "'</script>"); } else die("<script type=\"text/javascript\">alert('注册失败');history.back();</script>"); } }
public Member() { if (gform("app") == "loginout") { PassportBll bll = new PassportBll(); if (bll.loginout()) { string backurl = gform("backurl"); if (!string.IsNullOrEmpty(backurl)) HttpContext.Current.Response.Redirect(backurl); } } }
public MemberAdmin() { PassportBll p = new PassportBll(); minfo = p.get(); string backurl = System.Web.HttpContext.Current.Request.Url.AbsolutePath; if (HttpContext.Current.Request.QueryString != null) { backurl += "?"+HttpContext.Current.Request.QueryString.ToString(); backurl = HttpContext.Current.Server.UrlEncode(backurl); } if (string.IsNullOrEmpty(minfo.username)) System.Web.HttpContext.Current.Response.Redirect("/login.aspx?backurl="+backurl); }
public Frontend() { if (!File.Exists(HttpContext.Current.Server.MapPath(WEBPATH + "/config/install.lock"))) { new InstallBll(); } //检查站点是否关闭 conf = new WebConf(); if (conf.getAttr("webstate", "state") == "1") { die("<div style=\"border:1px solid #ed6501; margin:10px;background:#ffffcc;padding:10px;\">" + conf.getVal("webstate") + "</div>"); } //检查是否需要编译 if (conf.getVal("autocompiled") == "1") { string url = HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"]; url = url.Substring(url.LastIndexOf("/") + 1); TemplateCompiled t = new TemplateCompiled(new FileUrl(url)); } pagename = get_pathinfo(); DataTable sitet = new DataTable("config_site") ; DataTable sitetitle = new DataTable("config_title"); DataSet ds = find("webSite", ""); DataTable dt = ds.Tables[0]; DataColumn dc; DataColumn dctitle; foreach (DataRow key in dt.Rows) { if (!string.IsNullOrEmpty(key["key"].ToString())) { dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.AllowDBNull = true; dc.ColumnName = key["key"].ToString().Trim(); dc.Caption = key["key"].ToString().Trim(); dc.DefaultValue = key["content"].ToString(); //print(key["key"].ToString()); //print("<!--"+key["content"].ToString()+"-->"); //print("<br/>"); sitet.Columns.Add(dc); dctitle = new DataColumn(); dctitle.DataType = Type.GetType("System.String"); dctitle.AllowDBNull = true; dctitle.ColumnName = key["key"].ToString().Trim(); dctitle.Caption = key["key"].ToString().Trim(); dctitle.DefaultValue = key["title"].ToString(); sitetitle.Columns.Add(dctitle); } } DataRow dr1 = sitet.NewRow(); sitet.Rows.Add(dr1); DataRow dr2 = sitetitle.NewRow(); sitetitle.Rows.Add(dr2); config_site = sitet.Rows[0]; config_title = sitetitle.Rows[0]; web_title = config_site["website"].ToString(); //flg_nav 默认文件名 string path = HttpContext.Current.Request.ServerVariables["Path_Info"]; string pathname = Regex.Match(path, @"(?!=\/)\w+(?=\.)").Value; flg_nav = pathname; try { PassportBll p = new PassportBll(); if (p.islogin()) { islogin = true; MemberInfo m = p.get(); if (m.nickname != "") user_name = m.nickname; else user_name = m.username; } else islogin = false; } catch { islogin = false; } }
protected void do_reg() { string getuser_url = "https://graph.qq.com/user/get_user_info?" + "access_token=" + Session["access_token"] + "&oauth_consumer_key=" + Session["appid"] + "&openid=" + Session["openid"] + "&format=json"; HttpClient http = new HttpClient(); http.do_get(getuser_url, CHARSET); StringUrl url = new StringUrl(http.value); //注册临时账号 PassportBll bll = new PassportBll(); MemberInfo info = new MemberInfo(); info.username = Session["access_token"].ToString(); info.nickname = url.jget("nickname"); info.password = Session["access_token"].ToString(); bll.register(info.username,info.nickname,info.password); }