⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 changepassword.aspx.cs

📁 最好用的站点内容管理系统 全部源代码都有
💻 CS
字号:
//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NetCMS.Content;
using System.Xml;
using NetCMS.Config;
using System.Net;
using System.IO;

public partial class manage_ChangePassword : NetCMS.Web.UI.UserPage
{
    Ghistory inf = new Ghistory();
    protected void Page_Load(object sender, EventArgs e)
    {

        Response.Expires = 0;

        if (!IsPostBack)
        {
            Response.CacheControl = "no-cache";

        }
    }
    protected void saveSumbit(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            string UserNum = NetCMS.Global.Current.UserNum;
            string oldpass = Request.Form["oPass"].ToString();
            string newPass = Request.Form["newPass"];
            string pnewPass = Request.Form["pnewPass"];
            string MD = NetCMS.Common.Input.MD5(oldpass, true);
            string MD2 = NetCMS.Common.Input.MD5(newPass, true);
            if (oldpass == "" || newPass == "" || newPass.Length < 3)
            {
                PageError("填写完整。<li>或者密码太短密码不能小于3位</li>", "");
            }
            if (newPass != pnewPass)
            {
                PageError("两次密码不一致。", "");
            }
            else
            {
                if (inf.sel_sysUserInfo(UserNum, MD) == 0)
                {
                    PageError("原始密码错误。", "");
                }
                else
                {
                    if (inf.update_userInfos(MD2, UserNum, 1) == 0)
                    {
                        PageError("意外错误。", "");
                    }
                    else
                    {
                        //#region 整合Discuz!NT
                        //XmlDocument xmlDoc = new XmlDocument();
                        //string xmlName = Server.MapPath("../../api/dz/Adapt.config");
                        //AdaptConfig adConfig = new AdaptConfig(xmlName);

                        //if (adConfig.isAdapt)
                        //{
                        //    string adaptePath = adConfig.adaptPath;
                        //    adaptePath += "?username=" + NetCMS.Global.Current.UserName + "&password=" + newPass + "&tag=change";
                        //    //PageRight("修改密码成功", "ChangePassword.aspx", adaptePath, adaptPrams);

                        //    Uri uri = new Uri(adaptePath);
                        //    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
                        //    request.KeepAlive = false;
                        //    request.ProtocolVersion = HttpVersion.Version10;
                        //    request.Method = "GET";
                        //    request.ContentType = "application/x-www-form-urlencoded";
                        //    request.Proxy = System.Net.WebProxy.GetDefaultProxy();
                        //    request.AllowAutoRedirect = true;
                        //    request.MaximumAutomaticRedirections = 10;
                        //    request.Timeout = (int)new TimeSpan(0, 0, 1).TotalMilliseconds;
                        //    request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
                        //    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                        //    //Stream responseStream = response.GetResponseStream();
                        //    //StreamReader readStream = new StreamReader(responseStream, System.Text.Encoding.Default);
                        //    //readStream.ReadToEnd();
                        //}
                        //#endregion

                        PageRight("修改密码成功", "ChangePassword.aspx");
                    }
                }
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -