adnan khan
Programmer
Hello all,
I have created an application in visual foxpro and when the app start it search for a validate license if not found it focus a form on which we have to write a license key the problem i am facing is how can i make another app for generating a valid key for it.
the form on which we enter key is as follows can anyone guide.
I have created an application in visual foxpro and when the app start it search for a validate license if not found it focus a form on which we have to write a license key the problem i am facing is how can i make another app for generating a valid key for it.
the form on which we enter key is as follows can anyone guide.
Code:
xval = ALLTRIM(SUBSTR(thisform.txtkey_gen.value, 1, 5)+SUBSTR(thisform.txtkey_gen.value, 7, 5)+SUBSTR(thisform.txtkey_gen.value, 13, 5)+SUBSTR(thisform.txtkey_gen.value, 19, 5)+SUBSTR(thisform.txtkey_gen.value, 25, 4))
xval = STRTRAN(ALLTRIM(xval), '$', 's')
IF AT('s', xval)>0
MESSAGEBOX("NOT VALID KEY OR .", 64, ')
thisform.txtkey_gen.value = "$$$$$-$$$$$-$$$$$-$$$$$-"
mconfirm = 'N'
thisform.btn_cancel.click
RETURN
ENDIF
RELEASE str_encode
DIMENSION str_encode(15)
j = 1
mstr_decrypt = SPACE(1)
FOR i = 1 TO 30 STEP 2
str_encode[j] = SUBSTR(xval, i, 1)
mstr_decrypt = ALLTRIM(mstr_decrypt)+str_encode(j)
j = j+1
ENDFOR
zval = CHRTRAN(mstr_decrypt, "ZTYIXCWOVSU5T4X3R2Q1PAOBN6MDL7KFJ8IH", "1234567890ZYXDEFGHIJKLMNOPQRXVBUCTWA")
xcheck_date = SUBSTR(zval, 5, 2)+"/"+SUBSTR(zval, 7, 2)+"/20"+SUBSTR(zval, 9, 2)
IF CTOD(xcheck_date)<DATE()
MESSAGEBOX('Your Licence Key is Not Valid. Contact to [URL unfurl="true"]wwww.abc.com[/URL] or email to abc@gmail.com.', 64, ')
mconfirm = 'N'
thisform.btn_cancel.click
RETURN
ENDIF
newencript = CHRTRAN(SUBSTR(zval, 5, 6), "1234567890ZYXDEFGHIJKLMNOPQRXVBUCTWA", CHR(20)+CHR(11)+CHR(23)+CHR(15)+CHR(16)+CHR(17)+CHR(14)+CHR(25)+CHR(36)+CHR(64)+CHR(1)+CHR(8)+CHR(5)+CHR(3)+CHR(4)+CHR(7)+CHR(33)+CHR(34)+CHR(126)+CHR(128)+CHR(161)+CHR(162)+CHR(163)+CHR(164)+CHR(165)+CHR(166)+CHR(167)+CHR(168)+CHR(169)+CHR(170)+CHR(171)+CHR(171)+CHR(172)+CHR(173)+CHR(174)+CHR(175))
newdecript = CHRTRAN(newencript, CHR(20)+CHR(11)+CHR(23)+CHR(15)+CHR(16)+CHR(17)+CHR(14)+CHR(25)+CHR(36)+CHR(64)+CHR(1)+CHR(8)+CHR(5)+CHR(3)+CHR(4)+CHR(7)+CHR(33)+CHR(34)+CHR(126)+CHR(128)+CHR(161)+CHR(162)+CHR(163)+CHR(164)+CHR(165)+CHR(166)+CHR(167)+CHR(168)+CHR(169)+CHR(170)+CHR(171)+CHR(171)+CHR(172)+CHR(173)+CHR(174)+CHR(175), "1234567890ZYXDEFGHIJKLMNOPQRXVBUCTWA")
asiacheck = SUBSTR(newdecript, 1, 2)+"/"+SUBSTR(newdecript, 3, 2)+"/"+SUBSTR(ALLTRIM(STR(YEAR(DATE()))), 1, 2)+SUBSTR(newdecript, 5, 2)
lkdate = CTOD(asiacheck)
SELECT * FROM options INTO CURSOR tmpkey
SELECT options
USE
SELECT tmpkey
SET LIBRARY TO MD5.FLL
SET EXACT ON
IF clchk=md5hash(SUBSTR(mstr_decrypt, 1, 4))
DO unprotectfile.prg
SET LIBRARY TO vfpencryption.fll
UPDATE hardfile SET brefno = encrypt(ALLTRIM(newencript), '&*^', 1024)
SET LIBRARY TO MD5.FLL
SELECT hardfile
USE
MESSAGEBOX("Key is Validated."+CHR(13)+"Your Licence is updated. upto "+DTOC(lkdate), 64, ')
mconfirm = 'Y'
DO protectfile.prg
UPDATE tktcheck SET eamount = md5hash('L1') WHERE ALLTRIM(etax)=md5hash(ALLTRIM(ghardid))
lkcheck = .T.
thisform.btn_cancel.click
ELSE
DO protectfile.prg
MESSAGEBOX("NOT VALID KEY.", 48, ')
thisform.txtkey_gen.value = "$$$$$-$$$$$-$$$$$-$$$$$-"
thisform.txtkey_gen.refresh
thisform.txtkey_gen.setfocus
mconfirm = 'N'
USE
ENDIF
USE
RETURN