How to show update availability for a windows program (written in Delphi) on a PHP/Drupal site ?
Last modified: November 20, 2007 - 07:30
Here’s the PHP code that does the job
<?php
>
$latest = ‘0.5.6′; // define your latest version
$ver = $_GET[’ver’]; // for me this is like a command line argument get whatever is there after ?ver=
if ($ver) // Do the check only if the version info is passed
{
if (version_compare($latest,$ver) == 1) // there is an update available
print(”<hr/><strong>”.”An update to JALEdit is available. Latest version is :”.$latest.”</strong>”) ;
// display in bold about update status in between 2 lines
else
print(”<hr/><strong>”.”No update available.You are using the latest version.”.”</strong>”);
print “<hr/>”;
}
<
?>Here's the Delphi code using JCL
procedure TfrmSecMain.acncheckUpdatesExecute(Sender: TObject);
var
tempStr: string;
begin
tempStr := ‘http://jal.sunish.net/jaledit?ver=’;
with TJclFileVersionInfo.Create(Application.ExeName) do
try
tempStr := tempstr + Format(’%s’, [FileVersion]);
finally
Free;
end;
ShellExecute(0, ‘open’, pcHAR(tempStr), ”, ”, SW_SHOW);
end;The actual implementation details can be found at my site at http://blog.sunish.net/2007/11/18/how-to-show-update-availability-for-a-...
