以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]使用机器码和注册码进行加密的问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=122585) |
-- 作者:龙潭春早 -- 发布时间:2018/7/28 15:47:00 -- [求助]使用机器码和注册码进行加密的问题 在 AfterOpenProject 设置以下代码,进行登录验证。 大神帮着审一下,这段代码对吗? Dim Code As String = GetConfigValue("Register" & ComputerId,"") Dim Ok As Boolean If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then OK = True Else Forms("注册码输入窗口").Open() Code = GetConfigValue("Register" & ComputerId,"") If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then \'如果注册码正确 OK = True Else Messagebox.Show("您输入的验证码不正确,请重新输入!") End If End If
|
-- 作者:有点蓝 -- 发布时间:2018/7/28 16:15:00 -- 代码没有问题。运行有什么问题? |
-- 作者:龙潭春早 -- 发布时间:2018/7/28 17:16:00 -- 之前运行的时候,没有输入注册码,直接关闭窗口也通过了。 有些忘了是在什么条件下了。 另外,一直在考虑其中 Else 前后代码的逻辑性。 |
-- 作者:有点蓝 -- 发布时间:2018/7/28 19:01:00 -- Dim Code As String = GetConfigValue("Register" & ComputerId,"") Dim Ok As Boolean If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then OK = True Else Forms("注册码输入窗口").Open() Code = GetConfigValue("Register" & ComputerId,"") If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then \'如果注册码正确 OK = True Else Messagebox.Show("您输入的验证码不正确,请重新输入!") End If End If if OK = false then Syscmd.Project.Exit() return endif
|
-- 作者:龙潭春早 -- 发布时间:2018/7/28 20:56:00 -- 嗯 马上试一下 |