|
EXAMPLE 6
Items
In this example you will learn to
Protection schemes
Flowchart
Brief practice with example 5a
Start the trial period
Using the OLM control panel
In this example you will learn to:
1. Using the component in a protection scheme of multiple modules (schemes D, E and F).
2. Using the OLM control panel to manage online licensing.
Protection schemes
This example uses the schemes D, E and F
Scheme D

|
Scheme E

|
Scheme F

|
This example is the same as the example 5 with the only difference that here is used the Advanced OLM.
It is implemented as shown in the following flowchart:
Flowchart

|
procedure TForm1.FormCreate(Sender: TObject);
begin
DoRegister(False);
end;
function TForm1.maxrecords(n:integer):string;
begin
case n of
0: result:='50';
1: result:='200';
2: result:='1000';
3: result:='5000';
4: result:='20000';
5: result:='100000';
else result := 'Unlimited';
end;
end;
procedure TForm1.DoRegister(force:boolean);
var F : TRegForm;
begin
F:=TRegForm.Create(nil); //Create the registration Form
try
if force or (keydata.DaysLeft < 15) then F.ShowModal;
finally
FreeAndNil(F);
end;
if (keydata.Status = Registered) then begin
maxrec:=maxrecords(Values2Num(keydata.Values,2));
Button1.Enabled := (IsValueOn(keydata.Values,3,0));
Button2.Enabled := (IsValueOn(keydata.Values,3,1));
Button3.Enabled := (IsValueOn(keydata.Values,3,2));
end else begin
maxrec := '50';
Button1.Enabled := False;
Button2.Enabled := False;
Button3.Enabled := False;
Form1.wait(10);
end;
LRecNo.Caption := maxrec;
end;
|
Version (6a): is the development version, with the utilitarian section including buttons to start the trial period and delete the registration data in order to get back the application to its original status.
Version (6b): is the final release, where the trial period starts automatically and the utilitarian section were removed.
Brief practice with example 6a
From the Delphi IDE open the example 6a (\Examples\6\a)
Run the application
Hit the button or type F9 to start the program. In moments you will see the registration form:

Note that the current registration status is "Not registered". This is because it is first executed the program and for "a" versions, the trial period is not started automatically.
Now while the unregistered status, if you click on [Continue>>], the "wait" screen is displayed with the countdown:

This screen will also be displayed by clicking on the button [Free Features] from the main form.
We have two choices to start the trial period:
a) Offline way. Using the method MakeTrial () with the [Start Trial with MakeTrial ()] button.
b) Online way. Using the advanced OLM with the [Start with Advanced OLM] button using the OnlineStartTrial() method.
c) Other online way. Alternative method added in version 3.5: with the button [Synchronize] using the Synchronize method.
This example is configured to access the site www.av-soft.com wich you can use to do the practices.
Start the trial period
Related items: How to start the trial period
Now we have two choices to start the trial period:
a) Offline. Using the MakeTrial() method, through the [Start Trial with MakeTrial] button.
b) Online. Using the advanced OLM with the [Start with Advanced OLM] button which calls the OnlineStartTrial() method.
The example is configured to access the site www.av-soft.com which you can use to do the practices.
As in the previous example has the check boxes to select the modules you want enabled during the trial period and a "combo box" where you select the number of records allowed.
To test it select Special 1, 2 and 3 and 100,000 records. Click on the [Start with Advanced OLM] and you see the following message box informing the result of the operation, "Trial started":
You can also see that the current registration status has changed showing the message that you see below:

Now if you click on the [Continue>>] will go to the main application form where you will see the result of the operation performed, (now without the countdown screen):

You can see there are enabled the buttons that correspond with the selected check boxes, and also "Max Records Allowed" set to 100000.
With the button [Show Registration Data] see the registration data:

Here is a section of the source code used to calculate the Values field value based on the selected check boxes:
function TRegForm.values:string;
var val: word;
begin
val:=0;
if ch1.Checked then val := 1;
if ch2.Checked then val := val + 2;
if ch3.Checked then val := val + 4;
result := inttohex(val,3);
end;
On the val variable is calculated the value which is then allocated to the Values field.
if "Special 1" is checked, add 1 to val 1 = 0001 (binary)
if "Special 2" is checked, add 2 to val 2 = 0010 (binary)
if "Special 3" is checked, add 4 to val 4 = 0100 (binary)
By checking the boxes "Special 1", "Special 2" and "Special 3" we get (1 + 2 + 4) = 7
At binary view:
Special 1 = 0001
Special 2 = 0010
Special 3 = 0100
-------
Sum = 0111
Now let's see the source code for calculating the number of records allowed:
function TForm1.maxrecords(n:integer):string;
begin
case n of
0: result:='50';
1: result:='200';
2: result:='1000';
3: result:='5000';
4: result:='20000';
5: result:='100000'; //<---
else result := 'Unlimited';
end;
end;
. . .
maxrec:=maxrecords(Values2Num(F.keydata.Values,2));
. . .
The Values2Num function, extracts the value field corresponding to the selected nibble and converts it to decimal value.
Using the OLM control panel
Related Items: How to register an application using the OLM?
Now open the OLM control panel from a web browser (This has been tested with Google Chrome, Firefox, Opera and Internet Explorer).
Enter the URL: http://av-soft/olm3/s3cp.php
Within seconds you'll see the screen shown below. Enter the password "abc123" then click on the button [-> Go]:

We will see the screen below. Enter 12306 to "search for" and select the field "App ID", then click on the button [-> Go], It will roll records that match with the supplied AppID:

Now click on the edit icon to enter on the following box:

There are several sections:
Unmodifiable data: Could not be changed.
User data: Name, Company and email.
Selecting the action to take: You can choose an action to take when requesting data synchronization with the Synchronize method ().
(1) do not change segistration status: If you select this option does not generate a new key and fields Moved, Exten and Paid will be equal to 'N'.
(2) License is being moved to another computer: This will set the field Moved = 'Y'. Indicating that the license of this record is being moved to another computer.
(3) Allow to extend the trial period: Sets the field Exten = 'Y' to allow the generation of a new key to extend the trial period for a further period, normally 15 days but can be changed by assigning another value to the variable $extendays in genkeys3lib.php script or passing this value as parameter.
(4) The user paid for a new field values: This sets the field Paid = y (lowercase) indicating that it must generate a new key based on the current valid key, changing only the field "Values". Useful with temporary keys in case you want to add or remove a module controlled by the field "Values" but keeping the same period authorized by the existing temporary key.
(5) The user paid for a new key: Sets the field Paid = 'Y'. The user has paid for a new key so this will generate a new key based on the data to be specified in the section below.
Data for the new key to be generated: Here is entered the data to be used to generate the new key when the field Paid = 'Y'.
Field Users: Number of users who may register using the same key, one as primary and the rest as secondary users. This should be in the range [1 .. 254].
Field Instances: Determines the maximum number of instances that can run on any computer registered.
Field Values: Field "Values" for the new key to be generated. Already explained above how use it.
Field Days: Field "Days" for the new key to be generated. In temporary keys determines the period of days allowed, the value should be in the range [1 .. 65534]. For permanent keys is automatically assigned to 65535.
Operating buttons:
[Delete record]: Deletes the current record. Not enabled in av-soft.com.
[Save Record]: Save the changes made to the current record.
[Cancel]: Closes the dialog without modifying the data.
As a practice with this screen enter the following data as shown in the image below:

Then click on the button [Save Record] and will see the following message indicating that the record has been saved:

Click on [OK] to return to the control panel. Then Refresh the screen with the button [-> Go]. Now you will see the changes made.

Now click on the button [Synchronize] from the registration form

This will generate and register a new key, into the OLM and locally. See the new registration status:

Then coming back with [Continue>>] will see the changes made depending on the Values field:

|