Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21237

Serial registration issue

$
0
0
I have a keygen and I use the keygen to generate a license file so when users reload the main application it loads directly to main content. The issue I have is when I test it on my local machine it works, when I test it on another it doesn't work.

This is the form that asks the user for there username, email address:

Code:

Private Sub cmdRegistrar_Click()
    Dim Filenr As Integer
    Dim crypt As New clsCryptAPI
    Dim v As Collection
    Dim S As New serial
    Dim sEnc As String
    Dim DestFile As String
    Dim clave As String
    Set v = S.VerificarSerial(txtData(0), txtData(1), txtData(2), txtData(3))
    If v("ValidKey") Then
        sEnc = crypt.EncryptString(txtData(3), "QualityLider")
        DestFile = App.Path & "/register.lic"
        If (FileExist(DestFile)) Then Kill DestFile
        Filenr = FreeFile
        Open DestFile For Binary As #Filenr
        Put #Filenr, , sEnc
        Close #Filenr
        MsgBox "Serial number aproved" & vbCrLf & vbCrLf & "domain.com", vbInformation, "Register OK!!"
        Unload Me
        Form1.Show
    Else
        MsgBox "You Need to Register", vbExclamation, "Error!!"
    End If
    Set S = Nothing
    Set v = Nothing
    Set crypt = Nothing

End Sub

Private Sub Command1_Click()
Dim Filenr As Integer
    Dim crypt As New clsCryptAPI
    Dim v As Collection
    Dim S As New serial
    Dim sEnc As String
    Dim DestFile As String
    Dim clave As String
    Set v = S.VerificarSerial(txtData(0), txtData(1), txtData(2), txtData(3))
    If v("ValidKey") Then
        sEnc = crypt.EncryptString(txtData(3), "QualityLider")
        DestFile = App.Path & "/register.lic"
        If (FileExist(DestFile)) Then Kill DestFile
        Filenr = FreeFile
        Open DestFile For Binary As #Filenr
        Put #Filenr, , sEnc
        Close #Filenr
        MsgBox "Serial number accepted" & vbCrLf & vbCrLf & "Welcome to domain.com", vbInformation, "Success!!"
        Unload Me
        Form1.Show
    Else
        MsgBox "You Need to Register its Free", vbExclamation, "Error!!"
    End If
    Set S = Nothing
    Set v = Nothing
    Set crypt = Nothing
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
frmSplash.Show
Unload Me
End Sub

Private Sub Form_Load()
    Dim v As Collection
    Dim S As New serial
    Dim snhd As New clsHardDisk
    Dim Filenr As Integer
    Dim crypt As New clsCryptAPI
    Dim sEnc As String, sDec As String
    Dim filLic As String
    Dim byteArray() As Byte
    Dim tmp As String
    filLic = App.Path & "/register.lic"
    tmp = snhd.getSerialNumber
    If (FileExist(filLic)) Then
        Filenr = FreeFile
        Open filLic For Binary As #Filenr
        ReDim byteArray(0 To LOF(Filenr) - 1)
        Get #Filenr, , byteArray()
        Close #Filenr
        sEnc = StrConv(byteArray(), vbUnicode)
        sDec = crypt.DecryptString(sEnc, "QualityLider")
        Set v = S.VerificarLicencia(tmp, sDec)
        If v("ValidKey") Then
            Unload Me
            Form1.Show
            GoTo fin
        End If
    End If
    txtData(0).Text = tmp
    Label1.Caption = "You need to obtain a free licence to register." & vbCrLf & _
                    "Send us an email with your Username, Email & FingerPrint" & vbCrLf & _
                    "To: domain.com" & vbCrLf & _
                    "Free Registration gives you access to our Torrent Newsletter." & vbCrLf & _
                    "To: domain.com"
fin:
    Set crypt = Nothing
    Set c = Nothing
    Set snhd = Nothing
End Sub
Public Function FileExist(filename As String) As Boolean
On Error GoTo NotExist
    Call FileLen(filename)
    FileExist = True
    Exit Function
NotExist:
    FileExist = False
End Function

Private Sub Form_Terminate()
    End
End Sub

The application uses 3 class files see attachment.Attachment 94185

The keygen also uses those files.

This is the form that outputs the key.

Code:

Private Sub cmdGenerar_Click()
    Dim s As New Serial
    txtSerial = s.GenerarSerial(txtData(0), txtData(1), txtData(2))
    frmProbarSerial.txtData(0).Text = txtData(0)
    frmProbarSerial.txtData(1).Text = txtData(1)
    frmProbarSerial.txtData(2).Text = txtData(2)
    frmProbarSerial.txtData(3).Text = txtSerial
End Sub

Private Function validarDatos() As Boolean
    If InStr(txtData(2).Text, "@") = 0 Then
        MsgBox "Incorrect email", vbInformation, "Alerta"
        validarDatos = False
        Exit Function
    End If
    validarDatos = True
End Function

Private Sub Command1_Click()
Dim s As New Serial
    txtSerial = s.GenerarSerial(txtData(0), txtData(1), txtData(2))
    frmProbarSerial.txtData(0).Text = txtData(0)
    frmProbarSerial.txtData(1).Text = txtData(1)
    frmProbarSerial.txtData(2).Text = txtData(2)
    frmProbarSerial.txtData(3).Text = txtSerial
End Sub

Private Sub Form_Load()
    Left = 500
    Top = 500
    frmProbarSerial.Left = 480 + Me.Width
    frmProbarSerial.Top = Top
    frmProbarSerial.Show
End Sub


Private Sub Form_Terminate()
End
End Sub

Private Sub Form_Unload(Cancel As Integer)
End
End Sub

Question, when I get the computer id code and dont enter a user/email and i generate a key, they key works and the user is let in.

What I want to know is how to fix the code so the user can enter the username and password and enter the key provided and register, is there something I am missing here please? I am still new at this and learning with each step so please have patience with me as I may ask you lots of questions like, huh, what do you mean, can you explain that please and so on. Thank you.


jokerfool
Attached Files

Viewing all articles
Browse latest Browse all 21237

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>