Validate the serial number during Wizard Dialogs Stage only - Advanced Installer Community
ucramos
Posts: 16
Joined: Wed Jan 15, 2014 9:57 pm

Validate the serial number during Wizard Dialogs Stage only

I have a mysql table where i store the license that is created randomly. The user has access to its serial key from a profile on the website.

I used the files on this tutorial (Limited number of activations (serial number validations)) http://www.advancedinstaller.com/user-g ... de-sn.html

I have a trigger that generates a new serial number every time the table is changed. I did this to make sure that each serial is used by only the registered person. However i do not want to limit the number of licences for each user.

I use the validation_no field that is changed on serial check to provide the trigger to generate a new serial number.
As the check is made 2 times, and the first check triggers a new serial on the database, when i advance futher on the installation proccess, i get a error saying that the serial number is not valid.
The first check runs just fine.

i followed this tutorial to force only one check http://www.advancedinstaller.com/user-g ... de-sn.html , but i am still having 2 check.
I still have the message that the serial is invalid.

I know that the check is made 2 times even after doing all those steps, because i disabled the trigger that generated the new serial, the program installs correctly, and after the installation is done, i checked the database and in the validation_no field i have the number 2, having started with 0.

On the "Next" button in "UserRegistrationDlg", under Published event i have:

[SERIAL_VALIDATION] ; FALSE ; 1
Validate ProductID Property ; 0 ; 1
Display a specific dialog ; modificacoes ; AI_INSTALL AND (SERIAL_VALIDATION="TRUE")
[ACTIVATED] ; 1; AI_INSTALL AND (SERIAL_VALIDATION="TRUE")

Can you please help me? Is something wrong with the tutorial?
ucramos
Posts: 16
Joined: Wed Jan 15, 2014 9:57 pm

Re: Validate the serial number during Wizard Dialogs Stage o

Or maybe a new php query, that in the first time only checks the serial, and in the second time checks the serial and adds +1 to the validation_no field... if this is even possible.
ucramos
Posts: 16
Joined: Wed Jan 15, 2014 9:57 pm

Re: Validate the serial number during Wizard Dialogs Stage o

I solved the problem this way: Made the trigger update the serial number only when the number on validations_no is even.

DELIMITER //
CREATE TRIGGER `serial_no_update` BEFORE UPDATE ON `o6kvc_users`
FOR EACH ROW BEGIN
IF mod (NEW.validations_no,2) = 0 THEN
SET NEW.serial_no = concat(floor(rand()*10),floor(rand()*10),floor(rand()*10),floor(rand()*10),'-',floor(rand()*10),floor(rand()*10),floor(rand()*10),floor(rand()*10),'-',floor(rand()*10),floor(rand()*10),floor(rand()*10),floor(rand()*10),'-',floor(rand()*10),floor(rand()*10),floor(rand()*10),floor(rand()*10));
END IF;
END
//
DELIMITER ;
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Validate the serial number during Wizard Dialogs Stage o

Hello,
i followed this tutorial to force only one check http://www.advancedinstaller.com/user-g ... de-sn.html , but i am still having 2 check.
I still have the message that the serial is invalid.
I've tested the scenario, but I cannot replicate the behavior. Can you please make sure on the [Next>] button from "UserRegistrationDlg" dialog you have added a published event like this:
  • Control Event: Set installer property value
    Property: [ACTIVATED]
    Argument: 1
    Condition: SERIAL_VALIDATION = "TRUE"
an try again?

Also, please keep in mind that the above event should be set as the last event in the "Published Events" list. If the behavior still persist, can you please send us the .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ucramos
Posts: 16
Joined: Wed Jan 15, 2014 9:57 pm

Re: Validate the serial number during Wizard Dialogs Stage o

I just repeated the steps 2 times, and i always get a 2 value increment on "validation_no" field, so the query is being made 2 times.
I checked the table at each step of the install procedure. The first added value was after pressing next on the menu were the serial is asked, and the second value was added right before the installation process itself
ucramos
Posts: 16
Joined: Wed Jan 15, 2014 9:57 pm

Re: Validate the serial number during Wizard Dialogs Stage o

Well, i was using 2 builds. A defaultbuild and a testbuild. I had the same setting on the 2 builds but the feature did not work.

I decided to try to delete the testbuild, an create a new one. After compiling, this feature worked correctly.

Maybe some problem on the test build, with some old setting.
This problem is solved.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Validate the serial number during Wizard Dialogs Stage o

I'm not sure why this happened. However, I'm glad you got everything working now.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”