Foxtable(狐表)用户栏目专家坐堂 → 关于用户权限设置,求教


  共有7485人关注过本帖树形打印复制链接

主题:关于用户权限设置,求教

帅哥哟,离线,有人找我吗?
achillesice
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:20 积分:205 威望:0 精华:0 注册:2012/4/11 14:20:00
关于用户权限设置,求教  发帖心情 Post By:2012/5/12 12:44:00 [显示全部帖子]

最近在学如何设置各用户不同权限,前两天下载了一个《华海仓库管理软件》,其中关于用户权限设置代码如下:

Dim lst As WinForm.CheckedListBox
lst = e.form.Controls("CheckListBox1")
If Vars("用户").split(",")(0) = "rad0" And len(lst.value)<>158 Then
    msgbox("管理员必须拥有所有权限!",64,"提示")
    Return
End If
Dim str1,str2,str3 As String
str1 = e.Form.Controls("TextBox1").value
str2 = e.Form.Controls("TextBox2").value
str3 = e.Form.Controls("TextBox3").value
If str1 Is Nothing Then
    msgbox("用户名不能为空!",64,"提示")
Else If str2 Is Nothing Then
    msgbox("密码不能为空!",64,"提示")
Else If str3 <> str2 Then
    msgbox("两次输入的密码不一致,请重新输入!",64,"提示")
    e.Form.Controls("TextBox2").value = Nothing
    e.Form.Controls("TextBox3").value = Nothing
Else
    str2 = EncryptText(str2,"lgh","1qaz2wsx3edc")
    str3 = EncryptText(lst.Value & "","gdlgh","4rfv5tgb6yhn")
    Dim cmd As New SQLCommand
    cmd.C
    If Vars("用户")<>"" Then
        cmd.CommandText = "UPDATE [权限] SET 名称 = '" & str1 & "',密码 = '" & str2 & "',权限 = '" & str3 & "' WHERE 名称 = '" & Vars("用户").split(",")(1) & "'"
        cmd.ExecuteNonQuery()
        Forms("管理").Controls(Vars("用户").split(",")(0)).text = str1
    Else
        cmd.CommandText = "select count(*) from [权限] where 名称 = '" & str1 & "'"
        If cmd.ExecuteScalar() > 0 Then
            msgbox("用户名已存在!",64,"提示")
            e.Form.Controls("TextBox1").value = ""
            Return
        End If
        cmd.CommandText = "Insert Into [权限] (名称,密码,权限) values('" & str1 & "','" & str2 & "','" & str3 & "')"
        cmd.ExecuteNonQuery()
        With Forms("管理").Controls("CheckBox1")
            .Checked = not .Checked
        End With
    End If
    Forms("管理").Controls("rad0").Select()
    e.form.close
End If

求教,哪位高手给解读一下,具体作用,我打开数据库,看见的权限一栏是一长串字符,如何知晓这串字符是怎么生成的!


 回到顶部
帅哥哟,离线,有人找我吗?
achillesice
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:20 积分:205 威望:0 精华:0 注册:2012/4/11 14:20:00
  发帖心情 Post By:2012/5/12 14:22:00 [显示全部帖子]

是某一些地方不懂,

str3 = EncryptText(lst.Value & "","gdlgh","4rfv5tgb6yhn")
比如以上这段解读,是起什么作用

我能读懂的是str3 = EncryptText(加密文本)(ist.value,  后面什么意思没看懂

[此贴子已经被作者于2012-5-12 14:24:15编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
achillesice
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:20 积分:205 威望:0 精华:0 注册:2012/4/11 14:20:00
  发帖心情 Post By:2012/5/12 14:39:00 [显示全部帖子]

各位不用回复了,我看懂了!"gdlgh","4rfv5tgb6yhn"应该是加密规则

 回到顶部