protected override void Page_Show() { pagetitle = "投递文章"; UserInfo userinfo = GetUserInfo(); if (userinfo == null) { ShowError("投递文章", "请登录后再投递文章,谢谢~", "", "login.aspx"); } columnlist = Columns.GetColumnCollection(); if (YRequest.IsPost()) { int columnid = YRequest.GetInt("columnid", 0); string title = Utils.RemoveHtml(YRequest.GetString("title")); string summary = Utils.RemoveHtml(YRequest.GetString("summary")); string content = Utils.RemoveUnsafeHtml(YRequest.GetString("content")); ArticleInfo articleinfo = new ArticleInfo(); articleinfo.Columnid = columnid; articleinfo.Title = title; //articleinfo.Highlight = ddlHightlight.SelectedValue; articleinfo.Summary = summary.Length > 160 ? summary.Substring(0, 159) : summary; articleinfo.Content = content; articleinfo.Postdate = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); articleinfo.Uid = userinfo.Uid; articleinfo.Username = userinfo.Username; Articles.CreateArticle(articleinfo); Articles.RemoveArtilceCache(); ShowMsg("投递文章", "发布成功,跳转到栏目列表.", "", string.Format("showcolumn-{0}-1.aspx", articleinfo.Columnid)); } }
protected override void Page_Show() { pagetitle = "注册用户"; UserInfo userinfo = GetUserInfo(); if (userinfo != null) { ShowError("注册用户", "您已经登录了,请不要重复注册帐号!", "", "usercontrolpanel.aspx"); } if (ispost) { string email = YRequest.GetString("email"); string password = YRequest.GetString("password"); string username = YRequest.GetString("username"); string secquestion = YRequest.GetString("secretquestion"); string secanswer = YRequest.GetString("secretanswer"); if (email != string.Empty && password != string.Empty && username != string.Empty) { if (Users.GetUserInfo(username, 1) != null) { ShowError("注册用户", "注册失败,用户名已存在!", "", ""); } else if (Users.GetUserInfo(email, 0) != null) { ShowError("注册用户", "注册失败,Email已存在!", "", ""); } if (secquestion == string.Empty || secanswer == string.Empty) { ShowError("注册用户", "注册失败,找回密码提示或答案为空.请填写完整以保障帐号安全!", "", ""); } UserInfo info = new UserInfo(); info.Adminid = 0; info.Articlecount = 0; info.Bdday = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); info.Del = 0; info.Email = email; info.Secquestion = secquestion; info.Secanswer = Natsuhime.Common.Utils.MD5(secanswer); info.Groupid = 1; info.Hi = ""; info.Lastlogdate = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); info.Lastlogip = ""; info.Msn = ""; info.Nickname = username; info.Password = Natsuhime.Common.Utils.MD5(password); info.Qq = ""; info.Realname = ""; info.Regdate = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); info.Regip = YRequest.GetIP(); info.Replycount = 0; info.Topiccount = 0; info.Username = username; Users.AddUser(info); ShowMsg("注册用户", "注册帐号成功,跳转到用户中心.", "", "usercontrolpanel.aspx"); } } }
protected override void Page_Show() { if (YRequest.GetQueryString("action") == "logout") { HttpCookie admincookie = currentcontext.Request.Cookies["cmsntadmin"]; if (admincookie != null) { admincookie.Expires = DateTime.Now.AddYears(-1); currentcontext.Response.AppendCookie(admincookie); } ShowMsg("注销管理状态", "管理员登录注销成功,跳转到前台首页.", "", "index.aspx"); } UserInfo userinfo = GetUserInfo(); if (userinfo == null) { ShowError("后台登陆", "发生错误,请先登录前台,然后再访问此页.", "", "login.aspx"); } IsAdminLogined(); if (admininfo != null) { string action = YRequest.GetString("action") == string.Empty ? "default" : YRequest.GetString("action"); int id = YRequest.GetInt("id", 0); url = string.Format("frame.aspx?action={0}&id={1}", action, id); } else { url = ""; if (ispost) { //todo adminlogin string name = YRequest.GetFormString("loginname"); string password = YRequest.GetFormString("password"); string path = YRequest.GetFormString("path"); admininfo = Admins.GetAdminInfo(name, Natsuhime.Common.Utils.MD5(password)); if (admininfo != null && admininfo.Uid == userinfo.Uid) { HttpCookie admincookie = new HttpCookie("cmsntadmin"); admincookie.Values["adminid"] = admininfo.Adminid.ToString(); admincookie.Values["password"] = admininfo.Password; admincookie.Values["path"] = path; admincookie.Expires = DateTime.Now.AddMinutes(20d); currentcontext.Response.AppendCookie(admincookie); ShowMsg("后台登陆", "登录成功!开始跳转到后台首页", "", "admincp.aspx"); } else { ShowError("后台登陆", "登录失败,用户名或密码错误!", "", ""); } } } }
protected override void Page_Show() { pagetitle = "用户登录"; if (userid > 0) { ShowMsg("登录消息", "您已经登录了,请不要重复登录!", "", "usercontrolpanel.aspx"); } if (ispost) { string loginid = YRequest.GetString("loginid"); string password = YRequest.GetString("password"); if (loginid != string.Empty && password != string.Empty) { UserInfo info = Users.GetUserInfo(loginid, Natsuhime.Common.Utils.MD5(password), 0); if (info != null) { YCookies cookie = new YCookies("cmsnt"); cookie.WriteCookieValue("userid", info.Uid.ToString()); cookie.WriteCookieValue("password", info.Password); cookie.WriteCookieValue("username", info.Username); cookie.WriteCookieValue("adminid", info.Adminid.ToString()); cookie.AddCookieExpiresTime(30 * 3600 * 24); cookie.SaveCookie(); #region 插件登录 bool pluglogin = false; if (pluglogin) { Plugin.IUserProvider provider = Plugin.ProviderUtitily.GetUserProvider("DNT"); int uid = provider.IsUserExits(info.Username); if (uid > 0) { provider.Login(info.Username, password, false, 16000, ""); } else { provider.Register(info.Username, info.Password, info.Email, true); } } #endregion ShowMsg("登录消息", "登录成功,跳转到用户中心.", "", "usercontrolpanel.aspx"); } else { ShowError("登录消息", "登录失败,帐号或密码错误!", "", ""); } } else { ShowError("登录消息", "登录失败,用户名或密码为空,请检查输入框是否填写!", "", ""); } } }
protected override void Page_Show() { string type = YRequest.GetString("type").ToLower(); messageheader = Utils.HtmlEncode(YRequest.GetString("header")); messagefooter = Utils.HtmlEncode(YRequest.GetString("footer")); messagebody = Utils.HtmlEncode(YRequest.GetString("body")); redirecturl = YRequest.GetString("redirecturl") == string.Empty ? "javascript:history.back(-1);" : Utils.HtmlEncode(YRequest.GetString("redirecturl")); isautoredirect = type.ToLower() == "error" ? false : true; pagetitle = "系统提示"; }
protected override void Page_Show() { if (userid > 0) { ShowError("找回密码失败!错误原因:", "您已经登录了本站,如果需要修改密码,请在用户中心修改!", "", "usercontrolpanel.aspx"); } if (ispost) { findusername = YRequest.GetString("loginid"); if (findusername == string.Empty) { ShowError("找回密码失败!错误原因:", "输入框为空,请填写完整表格!", "", ""); } UserInfo info = Users.GetUserInfo(findusername, 0); if (info != null) { string secans = YRequest.GetString("secretanswer"); if (secans == string.Empty) { findusername = info.Email; secques = info.Secquestion; } else { string newpassword = YRequest.GetString("password"); if (newpassword == string.Empty) { ShowError("找回密码失败!错误原因:", "密码框为空,请填写新的密码!", "", ""); } if (Natsuhime.Common.Utils.MD5(secans) == info.Secanswer) { info.Password = Natsuhime.Common.Utils.MD5(newpassword); Users.EditUser(info); ShowMsg("找回密码消息", "重设密码成功,请用新的密码登录系统.", "", "login.aspx"); } else { ShowError("找回密码失败!错误原因:", "验证问答错误!", "", ""); } } } } }
protected override void Page_Show() { userinfo = GetUserInfo(); if (userinfo == null) { ShowError("用户中心", "身份验证失败,请登录后再访问用户中心,谢谢~", "", "login.aspx"); } else { pagetitle = string.Format("{0}的用户中心", userinfo.Username); int pageid = YRequest.GetInt("pageid", 1); int pagecount = Articles.GetUserArticleCollectionPageCount(userinfo.Uid, 8); pagecounthtml = Utils.GetPageNumbersHtml(pageid, pagecount, "usercontrolpanel.aspx", 8, "pageid", ""); myarticlelist = Articles.GetUserArticleCollection(userinfo.Uid, 8, pageid); if (ispost) { string oldpassword = YRequest.GetString("oldpassword"); string newpassword = YRequest.GetString("newpassword"); string newpassword2 = YRequest.GetString("newpassword2"); if (newpassword == newpassword2) { string newMD5Password = Natsuhime.Common.Utils.MD5(oldpassword); if (newMD5Password == userinfo.Password) { userinfo.Password = newMD5Password; Users.EditUser(userinfo); ShowMsg("用户中心", "", "修改密码修改成功.", ""); } else { ShowError("用户中心", "修改密码失败,旧密码验证错误!请检查是否输入正确,大小写锁定键是否被打开等.", "", ""); } } else { ShowError("用户中心", "修改密码失败,两次输入的新密码不一致.", "", ""); } } } }
protected override void Page_Show() { base.IsAdminLogined(); if (admininfo != null) { string url = ""; //string adminpath = YRequest.GetString("path") == string.Empty ? "admin" : YRequest.GetString("path"); string action = YRequest.GetString("action"); int id = YRequest.GetInt("id", 0); string name = YRequest.GetString("name"); if (action == "postarticle") { url = string.Format("{0}/postarticle.aspx", adminpath); } else if (action == "editarticle") { url = string.Format("{0}/postarticle.aspx?id={1}&action=edit", adminpath, id); } else if (action == "deletearticle") { url = string.Format("{0}/deleteadmin.aspx?articleid={1}", adminpath, id); } else if (action == "listarticle") { url = string.Format("{0}/articlelist.aspx?cid={1}", adminpath, id); } else if (action == "mgrcolumn") { url = string.Format("{0}/columnlist.aspx", adminpath); } else if (action == "mainsetting") { url = string.Format("{0}/mainsetting.aspx", adminpath); } else if (action == "template") { url = string.Format("{0}/template.aspx", adminpath); } else if (action == "settemplate") { url = string.Format("{0}/template.aspx?action=settemplate&folder={1}", adminpath, name); } else if (action == "createtemplate") { url = string.Format("{0}/template.aspx?action=create&folder={1}", adminpath, name); } else if (action == "") { } else if (action == "") { } else if (action == "default") { url = string.Format("{0}/articlelist.aspx?cid={1}", adminpath, id); } else { url = ""; } Server.Transfer(url); } else { currentcontext.Response.Redirect("admincp.aspx"); } }