using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Password : System.Web.UI.Page
{
public DataTable dtmember;
public string Cid;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Lang"] != null)
{
if (Session["Lang"] == "zh-cn")
{
RequiredFieldValidator1.ErrorMessage = "密码不能为空!";
RequiredFieldValidator3.ErrorMessage = "密码不能为空!";
RequiredFieldValidator2.ErrorMessage = "密码不能为空!";
CompareValidator1.ErrorMessage = "两次输入的密码不一样!";
Button1.Text = "完成";
}
else if (Session["Lang"] == "en-us")
{
RequiredFieldValidator1.ErrorMessage = "The password can not be empty!";
RequiredFieldValidator3.ErrorMessage = "The password can not be empty!";
RequiredFieldValidator2.ErrorMessage = "The password can not be empty!";
CompareValidator1.ErrorMessage = "The two passwords are not the same!";
Button1.Text = "Complate";
}
}
if (Session["member"] != null)
{
dtmember = (DataTable)Session["member"];
Cid = dtmember.Rows[0]["Cid"].ToString();
}
else
{
Cid = "";
Methods1.Methods1.MsgBox("请登录后再修改密码", "Default.aspx?ReturnUrl=" + Request.Url.ToString());
}
}
protected void ibtnfi_Click(object sender, EventArgs e)
{
string pwd = Methods1.Methods1.Md5(txtpwdold.Text.Trim(), 32);
string sqlstr = " select * from membertab where passwd = '" + pwd + "' and cid = '" + Cid + "'";
bool b = new common().ExecuteScalar(sqlstr, null);
if (b)
{
string password = Methods1.Methods1.Md5(txtpwd.Text, 32);//给密码加密
string sql = "update membertab set passwd='" + password + "' where cid='" + Cid + "'";
int i = Convert.ToInt32(DBH.DBHelper.ExecuteNonQuery(sql));
if (i > 0)
{ Methods1.Methods1.Alert(this, "密码设置成功");/* Response.Write(""); */}
else
{ Methods1.Methods1.Alert(this, "对不起,请重新设置密码");/* Response.Write(""); */}
}
else
{
//Response.Write("");
Methods1.Methods1.Alert(this, "对不起,原密码输入错误,请重新输入密码");
}
}
}