多用户访问级别登录 [英] Multi user access level login
问题描述
Hai您是否可以帮助我将登录页面用户的编码升级为多用户访问权限
我正在使用Visual Studio 2005软件,SQL数据库2005.
我只是将数据库名称创建为Danawa和表名称staff.
在表中,我有一个列的名字,电话,部门,ic,用户名,密码和地址.如果员工登录,他们将根据他们在列中的部门,商店和管理员指向界面部门,管理员和管理员.在我的登录页面中,我有2个文本框,分别是txtusername.Text和txpassword.Text.对于Button登录,它的名称是Btnlogin
下面是我要升级的登录页面编码
Hai would you help me to upgrade my coding for login page user to multiple user access
i am using visual studio 2005 software, sql database 2005.
i just create my database name as Danawa and table name staff.
Inside the table i have a column firstname, telephone, department,ic, username, password and address.If the staff are login they will pointing the interface dapartment store, admin and caunter based on they department in column;caunter, admin, store .In my login page i have 2 textbox which is txtusername.Text and txpassword.Text. For Button login it name is Btnlogin
Below is my coding for login page which i want to upgrade
Imports System.Data.sqlClient
Public Class loginpage
Private Sub btnlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.Click
Dim connection As New SqlConnection
connection.ConnectionString = " Data Source=Danawa;Integrated Security=True"
If txtusername.Text = "" And txtpassword.Text = "" Then
MsgBox("Please Enter Your Username And Password", MsgBoxStyle.Information, "Login")
Else
If txtusername.Text = "" Then
MsgBox("Please Enter Your Username ", MsgBoxStyle.Information, "Login")
Else
If txtpassword.Text = "" Then
MsgBox("Please Enter Your Password ", MsgBoxStyle.Information, "Login")
Else
If txtusername.Text = "Admin" And txtpassword.Text = "password" Then
Me.Hide()
Databasestatus.Show()
Else : MsgBox("Wrong Username And Password", MsgBoxStyle.Information, "Login")
End If
End If
End If
End If
End Sub
End Class
推荐答案
首先,不要在直接测试中存储您的密码-请先对其进行哈希处理.关于此处的操作,有一些注意事项:密码存储:操作方法. [^ ]
它是用C#语言编写的,但是代码很短,很明显可以更改为VB.
Firstly, don''t store your password in straight test - hash it first. There are some notes on what to do here: Password Storage: How to do it.[^]
It''s in C#, but the code is pretty short and obvious to change to VB.
这篇关于多用户访问级别登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!