user_board_passupdo.aspx.cs
资源名称:论坛源码.rar [点击查看]
上传用户:scene123
上传日期:2010-02-19
资源大小:3311k
文件大小:3k
源码类别:
.net编程
开发平台:
C#
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.SessionState;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- using System.Data.OleDb;
- using System.Configuration;
- using System.Text;
- using System.Web.Security;
- using System.Security.Cryptography;
- namespace kuangren
- {
- /// <summary>
- /// user_board_passupdo 的摘要说明。
- /// </summary>
- public class user_board_passupdo : System.Web.UI.Page
- {
- protected int intRunTime;
- protected DateTime dtStartTime = DateTime.Now;
- public string usercookies;
- protected System.Data.OleDb.OleDbCommand cmd;
- protected System.Data.OleDb.OleDbCommand cmd4;
- protected System.Data.OleDb.OleDbConnection conn;
- protected DataSet dsPending;
- public string passjudge;
- public string s1;
- public string s2;
- public string passjudgeresult;
- public string sql;
- public string showinfor;
- public string showinfor1;
- public string newpass;
- public string newpass1;
- protected string OleDbSqlforum;
- protected string OleDbsql;
- private void Page_Load(object sender, System.EventArgs e)
- {
- if (Request.Cookies["jusername"]!=null)
- {
- usercookies=Request.Cookies["jusername"].Value;
- }
- else
- {
- Response.Redirect("logine.aspx");
- }
- s1=(FormsAuthentication.HashPasswordForStoringInConfigFile(Request.Form["passold"].ToString().Trim(),"MD5"));
- s2=s1.Substring(8,s1.Length-16).ToLower();
- newpass1=(FormsAuthentication.HashPasswordForStoringInConfigFile(Request.Form["passnew"].ToString().Trim(),"MD5"));
- newpass=newpass1.Substring(8,newpass1.Length-16).ToLower();
- conn = new OleDbConnection(ConfigurationSettings.AppSettings["cnFriends.ConnectionString"]);
- sql="SELECT u_pass from userinfo where u_user='"+usercookies+"'";
- dsPending=new DataSet();
- OleDbDataAdapter adWord=new OleDbDataAdapter(sql,conn);
- adWord.Fill(dsPending,"userinfo");
- passjudge=Convert.ToString(dsPending.Tables[0].Rows[0]["u_pass"]);
- if (s2==passjudge)
- {
- showinfor="密码修改成功";
- showinfor1="<b>操作成功</b><br><br><li> 您的密码已经成功修改</li>";
- StringBuilder sb=new StringBuilder();
- ArrayList values=new ArrayList();
- sb.Append("update [userinfo] set u_pass='"+newpass+"'where u_user='"+usercookies+"'");
- OleDbsql=String.Format(sb.ToString(),values.ToArray());
- cmd=new OleDbCommand(OleDbsql,conn);
- conn.Open();
- bool doredirect=true;
- try
- {
- cmd.ExecuteNonQuery();
- }
- catch
- {
- doredirect=false;
- }
- finally
- {
- conn.Close();
- }
- if(doredirect)
- {
- }
- else
- {
- }
- }
- else
- {
- showinfor="密码修改失败";
- showinfor1="<b>操作失败</b><br><br><li> 您的密码旧密码输入错误</li>";
- }
- conn.Close();
- }
- #region Web 窗体设计器生成的代码
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- }
- }