using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using xabaraCOM;

public partial class WebXabara_userPw : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        admin a = new admin();
        javasrcipt js = new javasrcipt();
        sqlServer sql = new sqlServer();
        a.check("|adminPW|");

        string userID = Request.QueryString["id"].ToString().Trim();
        if (userID.Equals(a.uid))
        {
            js.div(false, "", "text", "不能给自己密码初始化或操作错误！", 300, 0, "userList.aspx?page=" + Request.QueryString["page"], "goto");
        }
        else
        {
            string dimStr = "@UserPW";
            string[] strValue = new string[1];
            string strVlaueTemp = xabara.rnd("abc", 1) + xabara.rnd("abc123", 7).ToLower();
            strValue[0] = xabara.md5(strVlaueTemp).ToString();

            string returnStr = sql.update("AdminUser", dimStr, strValue, "UserId='" + userID + "'");
            if (returnStr.Equals("更新成功"))
            {
                sql.log(a.uid, "admin", "密码初始化：" + userID);
                js.div(false, "", "text", "新密码：" + strVlaueTemp, 300, 0, "userList.aspx?page=" + Request.QueryString["page"], "goto");
            }
            else
            {
                js.div(false, "", "text", "操作失败！", 300, 0, "userList.aspx?page=" + Request.QueryString["page"], "goto");
            }
        }
    }
}
