Online Serial Key Validation with InstallAware, the Code Part

Hi all! It’s been a few days since my last post about wrapping our update mechanism around your application and it’s time for some web server code samples; but first, I wanted to make an enhancement to the update script.

If we want to change our “Run Program As” commands, we’ll have to edit multiple parts of the update script. At best, this is tedious; typically it will introduce errors with forgotten or misplaced commands. The solution is simple: we’ll use the Label and GoTo Label MSIcode commands to create a re-usable region of code. This way, we’ll remove all pairs of existing “Run Program As” and “Terminate Installation” commands, replacing them with a GoTo Label command that points to a new “Label” called “RunProgramSection“, with the “Run Program As” and “Terminate Installation” commands underneath.

becomes:

So now, instead of making changes all over the place in the MSIcode script, I only have to make one change under the Label command. That way, I can re-use this code block in other projects:

I can also build in more sophisticated behavior, adding more MSIcode commands. Lets say you want to run two programs – one might be a tray application and the other one the “real” application.

Quite easily done. Extensibility and scalability are everything these days!

And now for some server side code. First, please make sure you’re familiar with a server side scripting language like PHP or ASPX. Please visit www.asp.net and www.php.net if you need a jumpstart. I’ll assume that you’ve done your homework and that you can follow the simple scripts provided below.

First some PHP. If you remember, I pass some parameters from my MSIcode InstallAware setup/client script to the web/server script as URL parameters. In PHP, URL parameters are stored inside a predefined variable called $_GET, which is a global array. If you want to read a user’s serial number and your parameter is called serial, you can try the following:

$serial = strip_tags($_GET[‘serial’]);

Now, the PHP script variable $serial has our parameter’s value. Let’s see if the serial number provided is actually valid:

if ( CheckIfLegimitate($serial) )
return “1,”.srand(time());
else
return “0,”.srand(time());

If the serial is valid, the PHP script above returns “1”, or “0” otherwise. Either way, the return value is appended with a comma delimited random number. Back on the InstallAware setup/client side, I read this value using the “Download File” MSIcode command, and I then parse it using Parse String; which lets me obtain both the status code (“1” or “0”), and of course the random number.

Next post: Database schema scripts and more code. It’s going to be the last post from these series so, stay tunned!

Panagiotis Kefalidis
Software Design Team Lead
InstallAware Software Corporation

6 Replies to “Online Serial Key Validation with InstallAware, the Code Part”

  1. obviously like your web-site however you have to check the spelling on several of your posts. Several of them are rife with spelling problems and I to find it very bothersome to inform the reality however I’ll surely come again again.

  2. dߋkumentasi otоmatіs, trаnsfᥱr fіlᥱ,
    laρoгаn, dan tοқⲟҺ-toҝοһ daⲣat mᥱngսгаngі
    աaкtᥙ Ԁan սang үang ⅾіhаbіκѕκan untuк layanan ⲣеncetaқаn ԁаn mᥱmᥙngкіnkаn untսκ ᴡɑκtս maкsіmսm սntuк dііnvеstаsіҝan paԁa mеlɑқᥙκan ɦаⅼ-һɑl
    yаng рenting ⅾɑгі
    ҝlіen dаn ρᥱnjᥙаlɑn ѕᥙԁut
    рandɑng . Ꭰuniа
    aԁаlaɦ sеmᥙɑ tᥱntang реrⅾaɡangɑn, Ԁan ρdrɗɑցangan рeгⅼᥙ ԁibaуаг қеmƄɑlі, taρі ⲟսtѕоᥙrсing ⅼayanan ⲣеngеmкbаngan աeЬ mеmbаntu оrang ɗi ѕuԀսt үang ƅеrⅼɑwanazn ɗɑгі
    ɗսniа untᥙқ mеmƄɑүaг ɗеngаn instɑn .

    Տtrᥙҝtսг Рᥱгіncian Κеrϳa (WBՏ) аdɑⅼaɦ аlat mаnajеmen ρrоуᥱк үɑng ᥙmսm ⅾіցᥙnkan үаng mеmЬantu tim рrοуᥱҝ mеndaраtκan ⲣеmɑҺɑmɑn tеnntɑng beгbagɑі јеniѕ pеҝегjaаn yɑng ⅾіbᥙtuһкan սntսκ menyeⅼеѕаікan sᥱbᥙa ргоүеκ .

  3. Hey there I am so excited I found your blog page, I really found you by error, while I was researching on Digg for something else, Anyhow I am here now and would jjust lime
    to say thanks ffor a tremendous post and a all round interesing blog (I also love the theme/design), I don’t hzve time to go thropugh iit alll att the minute but I have book-marked it and also added in your RSSfeeds, so when I have time I will be back to read much more, Pleas do keep uup tthe
    excellent jo.

  4. etichete autocolante etichete carton personalizate autoadezive pret ieftin stantate .HISTAMIN Control – Cutie
    30 Blistere. Autentifica-te pentru pret! Quercitina, Bromelaina, MSM, Extract de seminte de struguri, Dimetilglicina, Acid ascorbic,

  5. I believe that avoiding prepared foods will be the first step to help lose weight. They will often taste fine, but packaged foods possess very little vitamins and minerals, making you feed on more only to have enough strength to get through the day. If you are constantly eating these foods, changing to cereals and other complex carbohydrates will help you to have more vigor while eating less. Thanks alot : ) for your blog post.

Leave a Reply to Raphael Gardiner Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.