I have this code which i use to validate a serial code: the user types their serial code in a box which then posts to a webpage to check against a MySQL database and says VALID if the key is valid and INVALID if not
if the key is entered correctly, there is no problem. If the key is NOT then the page for entering the serial is shown again. The only difference is that when you enter the key the second time, it doesn't matter if the key is correct or not, it doesn't bother to validate. Please advise. I have posted the bit of code which validates below:
Function SerialPageShow
!insertmacro MUI_HEADER_TEXT "Enter Serial Code" "Enter the software serial code to continue."
PassDialog:😁ialog Serial \
/HEADINGTEXT 'Please enter the serial code...' \
/CENTER \
/BOXDASH 12 70 5 '' \
/BOXDASH 92 70 5 '' \
/BOXDASH 172 70 5 '' \
/BOXDASH 252 70 5 '' \
/BOX 332 70 5 ''
Pop $R0 # success, back, cancel or error
FunctionEnd
Function SerialPageLeave
## Pop values from stack
Pop $R1
Pop $R2
Pop $R3
Pop $R4
Pop $R5
;!insertmacro MUI_HEADER_TEXT "Validating..." "Please Wait"
;!insertmacro MUI_INSTALLOPTIONS_DISPLAY "validateSerial.ini"
;MessageBox MB_OK "Break1"
FunctionEnd
Function validateSerial
;MessageBox MB_OK "Break2"
;## Disable the Back button
;GetDlgItem $R6 $HWNDPARENT 3
;EnableWindow $R6 0
;## Disable the Next button
;GetDlgItem $R6 $HWNDPARENT 1
;EnableWindow $R6 0
GetTempFileName $0
InetLoad::load /post "licence=$R1-$R2-$R3-$R4-$R5" "http://www.mysite.co.uk/install/verify.php" "$0" /slient ""
Pop $1 # $1 now holds the exit code for above
FileOpen $2 $0 "r"
FileRead $2 $3
FileClose $2
${If} $3 == 'INVALID'
MessageBox MB_OK|MB_ICONEXCLAMATION "Invalid Serial"
Call SerialPageShow
${Else}
Goto serialOK
${EndIf}
Abort
serialOK:
FunctionEnd