Help With Updater License Check - Advanced Installer Community
jlh211
Posts: 18
Joined: Tue Nov 12, 2013 1:02 am

Help With Updater License Check

So I am currently using advanced installed and Server-Side license validation, but am really confused when it comes to the "License Check" value. Can someone please help me create a PHP value that does the following:

1. For the initial Server-Side validation, I would like to "POST" the installation date of the install to my current license database.

2. I would like the License Check to check the "Install_Date" row as well as the current date (server date) and if it is longer than 1 year, it will not allow an update installation, and if it is shorter than 1 year the install can proceed.

Can anyone help point me in the right direction to create the PHP code for this?

Thanks!
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Help With Updater License Check

Hi,

Sorry for the delayed reply.
1. For the initial Server-Side validation, I would like to "POST" the installation date of the install to my current license database.
To achieve this you can simply create a PHP variable that will contain the date of the installation, then store that variable to your database like follows:

Code: Select all

$date=date("Y-m-d H:i:s");

mysql_query("INSERT INTO YourTable (Install_Date) VALUES ('$date')");
2. I would like the License Check to check the "Install_Date" row as well as the current date (server date) and if it is longer than 1 year, it will not allow an update installation, and if it is shorter than 1 year the install can proceed.
To achieve this you can verify if the "Install_Date" row already contains a value and if so, you can compare its value with the value of the current date:

Code: Select all

$user_sn=trim($_POST['sn']); // serial number entered by the user
$current_date=date("Y-m-d H:i:s");
$install_date;

$get_install_date = "SELECT Install_Date FROM YourTable WHERE sn = '$user_sn' ";  // sn - the database row that contains the serial numbers

$result=mysql_query($get_install_date);
$row=mysql_fetch_array($result);
$install_date=$row['Install_Date'];

$date1 = strtotime($install_date);
$date2 = strtotime($current_date);
$secs = $datetime2 - $datetime1;   // return the difference in seconds
$days = $secs / 86400;    // compute the days

if($days > 365)
	echo "License expired";
Let us know if this helped.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jlh211
Posts: 18
Joined: Tue Nov 12, 2013 1:02 am

Re: Help With Updater License Check

Thank you! Is there a way to have the uninstaller communicate with the database so that when the program is uninstalled on a computer the database table for validations will be reset?
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Help With Updater License Check

Hi,

In order to achieve this you can use the Send install information to your web server predefined custom action to send, during the uninstall, the information you need to your web server (i.e. PHP script) which will make the necessary modifications to the database table.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jlh211
Posts: 18
Joined: Tue Nov 12, 2013 1:02 am

Re: Help With Updater License Check

I;m not very good with PHP. I just upgraded to Enterprise so I can do this, but would you mind giving me a sample copy of PHP script?

Thanks!
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Help With Updater License Check

Hello,

You can take a look on our "Configure server-side serial number validation" article which debates how to use the "Server-side validation" option from "Licensing -> Serial Validation Page" page. Also, you can download a sample from there.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jlh211
Posts: 18
Joined: Tue Nov 12, 2013 1:02 am

Re: Help With Updater License Check

Yes, but what about for uninstall?
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Help With Updater License Check

Hi,

I'm not sure what is the information that you want to reset in the database during the uninstallation of the product, but you can take a look on the How do I collect installation data and send it to my web server article which details the way you can communicate with the database through the "Send install information to your web server" custom action.

You can also find a good PHP example at the bottom of that page, so you can take a look of it. Basically, you can create a "Send install information to your web server" custom action where you add the properties that will be sent to the script mentioned in the URL field, and that script will do the necessary modifications in the database.

Just let us know if you have any other question.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”