前台的话自己写下源码网站,用户及密码,登录按钮
提供下后台登录代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Web
{
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.Cookies[\"Cookles\"] != null)
{
if (Request.Cookies[\"Cookles\"][\"User_ID\"] != null && Request.Cookies[\"Cookles\"][\"User_Name\"] != null)
{
TexUname.Text = Request.Cookies[\"Cookles\"][\"User_Name\"].ToString();
if (Request.Cookies[\"Cookles\"][\"User_Pwd\"] != null & Request.Cookies[\"Cookles\"][\"User_Pwd\"] != \"\")
{
this.TexUpwd.Attributes.Add(\"value\", Request.Cookies[\"Cookles\"][\"User_Pwd\"].ToString());
}
}
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string tocode = \"!\";
if (Request.Cookies[\"Cookles\"] == null)
{
if (Session[\"CheckCode\"] != null)
{
tocode = Session[\"CheckCode\"].ToString().Trim().ToLower();
}
else
{
Response.Redirect(\"login.aspx\");
}
}
string uname = TexUname.Text;
string upwd = TexUpwd.Text;
string coke = Texchack1.Text.ToString().Trim().ToLower();
if (Request.Cookies[\"Cookles\"]== null)
{
if (coke != tocode.ToString().Trim())
{
Maticsoft.Common.JavaSceipt.GetJavaScript(\"验证码不正确!\");
return;
}
}
if (!new Maticsoft.BLL.Member().Exists(uname, Maticsoft.Common.Constant.md5(upwd, 32)))
{
Maticsoft.Common.JavaSceipt.GetJavaScript(\"用户名或密码不正确!\");
return;
}
Maticsoft.Model.Member user = new Maticsoft.BLL.Member().GetModel(\"ChvUname=\'\" + uname + \"\' and ChvUpwds=\'\" + Maticsoft.Common.Constant.md5(upwd, 32) + \"\'\");
if (Request.Cookies[\"Cookles\"] != null)
{
}
myCook.Values.Add(\"User_ID\", \"\");
myCook.Values.Add(\"User_Name\",\"\");
myCook.Values.Add(\"User_Pwd\", \"\");
Response.Cookies.Add(myCook);
myCook.Expires = DateTime.Now.AddDays(-1);
}
if (user != null)
{
Session[\"User_ID\"] = user.IntMId.ToString();
Session[\"User_Name\"] = user.ChvUname.ToString();
Session[\"IntStatus\"] = user.IntStatus.ToString();
Response.Redirect(\"index.aspx\");
}
else
{
Maticsoft.Common.JavaSceipt.GetJavaScript(\"用户名不存在!\");
return;
}
}
}
}
看不懂哪个地方再问我吧
如果细心观察你就会发现的 z 5 6 a,( Ο m3