UserControls/UserLogin.ascx.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using BookShop;

public partial class UserLogin : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

	protected void LoginBtn_Click(object sender,ImageClickEventArgs e)
	{		
		if (UserName.Text == null || UserName.Text == "" || UserName.Text.Length <= 0)
		{
			ShowMessage("用户名称为空,请输入用户名称!");
			return;
		}

		if (Password.Text == null || Password.Text == "" || Password.Text.Length <= 0)
		{
			ShowMessage("用户密码为空,请输入用户密码!");
			return;
		}

		String userId = "";
		String roleId = "";

		///定义类并获取用户的登陆信息            
		BookShop.User user = new User();
		SqlDataReader recu = user.GetUserLogin(UserName.Text.Trim(),
			BookShop.User.Encrypt(Password.Text.Trim()));

		///判断用户是否合法
		if (recu.Read())
		{
			userId = recu["UserID"].ToString();
			roleId = recu["RoleID"].ToString();
		}
		recu.Close();

		///验证用户合法性,并跳转到系统平台
		if ((userId != null) && (userId != ""))
		{
			Session["UserID"] = userId;
			Session["UserName"] = UserName.Text;
			if (roleId != "")
			{
				Session["RoleID"] = roleId;
			}

后面还有 16 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。