You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MyShippingWeb.Classes;
namespace web.Web.Mld
{
public partial class SysSettings : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request["action"] == "pwd")
{
string msg = this.SavePWD();
Response.Write(msg);
Response.End();
}
if (Request["action"] == "comname")
{
string msg = this.SaveComName();
Response.Write(msg);
Response.End();
}
}
private string SavePWD()
{
string oldpwd = Request["oldpwd"];
string newpwd1 = Request["newpwd1"];
string newpwd2 = Request["newpwd2"];
if (!newpwd1.Equals(newpwd2))
{
return "两次输出的密码不一致!";
}
string chksql = "select count(*) from users where uname = 'admin' and upwd='"+oldpwd+"'";
int ckrst = Convert.ToInt32(SQLHelper.ExcuteScalarSQL(chksql));
if (ckrst <= 0)
{
return "密码验证失败!";
}
string result = "";
string copyright = Request["copyright"];
StringBuilder sb = new StringBuilder();
sb.Append("update users ");
sb.Append("set upwd = '" + newpwd1 + "' ");
sb.Append(" where uname = 'admin'");
int rst = SQLHelper.ExcuteSQL(sb.ToString());
result = rst > 0 ? "更新成功" : "更新失败";
return result;
}
private string SaveComName() {
string result = "";
string comname = Request["comname"];
StringBuilder sb = new StringBuilder();
sb.Append("update baseinfo ");
sb.Append("set content = '" + comname + "' ");
sb.Append(" where name = 'comname'");
int rst = SQLHelper.ExcuteSQL(sb.ToString());
result = rst > 0 ? "更新成功" : "更新失败";
return result;
}
}
}