以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  注册码有效期  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=89665)

--  作者:五洲403
--  发布时间:2016/8/26 15:28:00
--  注册码有效期

请问老师,如何设置注册码的有效期!假如一个月到期了,注册码就失效了,需要重新注册!望老师赐教

 


--  作者:五洲403
--  发布时间:2016/8/26 15:31:00
--  
Dim n As Integer = Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Count",1)
Dim Code As String =Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Register" & ComputerId,"")
Dim Ok As Boolean
If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then \'如果注册码正确
    OK = True
Else
    If n > 5 Then
        Forms("注册码").Open()
        Code = Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Register" & ComputerId,"")
        If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then \'如果注册码正确
            OK = True
        End If
    End If
    If n > 20 AndAlso Ok = False Then
        Messagebox.Show("您正在使用的产品已经超出试用次数!")
        Syscmd.Project.Exit()
    End If
End If
Registry.SetValue("HKEY_CURRENT_USER\\Software\\MyApp","count",n + 1)

--  作者:大红袍
--  发布时间:2016/8/26 15:36:00
--  

 把到期日期写入注册码里面,如

 

dim str as string = computerId
Dim zcm As String = EncryptText(str & "|" & new Date(2016,9,1), "abc", "abc")
output.show(zcm)

 

\'-----------------------

 

Dim s As String = DecryptText(zcm, "abc", "abc")
output.show(s)
msgbox(s.split("|")(1))


--  作者:五洲403
--  发布时间:2016/8/26 15:42:00
--  
大神,可以帮我直接合在上面那段代码上面吗?谢谢!跪求!
--  作者:五洲403
--  发布时间:2016/8/26 16:08:00
--  

Dim n As Integer = Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Count",1)
Dim Code As String =Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Register" & ComputerId,"")
Dim Ok As Boolean
If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then \'如果注册码正确
    OK = True
Else
    If n > 5 Then
        Forms("注册码").Open()
        Code = Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Register" & ComputerId,"")
        If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then \'如果注册码正确
            OK = True
        End If
    End If
    If n > 20 AndAlso Ok = False Then
        Messagebox.Show("您正在使用的产品已经超出试用次数!")
        Syscmd.Project.Exit()
    End If
End If
Registry.SetValue("HKEY_CURRENT_USER\\Software\\MyApp","count",n + 1)

 

dim str as string = computerId
Dim zcm As String = EncryptText(str & "|" & new Date(2016,9,1), "abc", "abc")
output.show(zcm)

 

 

Dim s As String = DecryptText(zcm, "abc", "abc")
output.show(s)
msgbox(s.split("|")(1))


 


--  作者:五洲403
--  发布时间:2016/8/26 16:08:00
--  

这样改了 没有效果啊 !本人小白,望老师不宁赐教!谢谢


--  作者:大红袍
--  发布时间:2016/8/26 16:40:00
--  

 

[此贴子已经被作者于2016/8/26 16:42:52编辑过]

--  作者:大红袍
--  发布时间:2016/8/26 16:44:00
--  

Dim n As Integer = Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Count",1)
Dim Code As String =Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Register" & ComputerId,"")
Dim Ok As Boolean

If Code > ""  Then \'如果注册码正确
    Dim str As String = DecryptText(Code,"abc","abc")
    Dim ary() As String = str.Split(",")
    If ary.length = 2 AndAlso ary(1) >= Date.Now AndAlso ary(0) = ComputerId Then
        OK = True
    End If
End If
If ok = False Then
    If n > 5 Then
        Forms("注册码").Open()
        Code = Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Register" & ComputerId,"")
        If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then \'如果注册码正确
            OK = True
        End If
    End If
    If n > 20 AndAlso Ok = False Then
        Messagebox.Show("您正在使用的产品已经超出试用次数!")
        Syscmd.Project.Exit()
    End If
End If
Registry.SetValue("HKEY_CURRENT_USER\\Software\\MyApp","count",n + 1)


--  作者:五洲403
--  发布时间:2016/8/26 16:45:00
--  
图片点击可在新窗口打开查看  谢谢老师,越来越喜欢老师了 哈哈