Hi Craig,
Here is a method which allows you to receive the username, company and email on your server (I attached a sample project):
- create and configure your Advanced Installer project
- go to the
Custom Actions page and create a "New Attached Custom Action"
- select the "C:\Program Files\Caphyon\Advanced Installer 6.3.1\custact\serval.dll" file when prompted for the source of the custom action
- use the default options for this custom action
- go to the
Dialogs page and create a custom dialog
- add three Edit box controsl which will retrieve the username, company and email of the user
- set the properties of these edit boxes to
USERNAME and
COMPANYNAME and
PIDKEY
- select the "Next" button on your custom dialog
- make sure it has these Published control events (in this exact order):
Code: Select all
[PIDKEY] 1 AI_INSTALL AND NOT PIDKEY
[AI_SERVAL_TYPE] 3 AI_INSTALL
[AI_SERVAL_URL] http://myserver.com/collect.php AI_INSTALL
DoAction serval.dll AI_INSTALL
NewDialog FolderDlg AI_INSTALL
- note that you need to replace "
http://myserver.com/collect.php" with an URL to the "collect.php" file on your server
- place the "collect.php" file on your server and make sure it has write access
Here is the content of the "collect.php" file:
Code: Select all
<?php
/**
* Server response to client application.
*/
function ServerResponse($killScript = false)
{
echo "601";
if($killScript == true)
die();
}
// test if there is any information to collect
if(!isset($_POST['username']) || trim($_POST['username']) == '')
ServerResponse(true);
$serverAppDir = dirname(__FILE__) . '/';
$installLog = $serverAppDir . 'installs/users.log';
// create directory, if not present
mkdir(dirname($installLog));
// open file in "append" mode (create if not exists)
if(!$handle = fopen($installLog, 'a'))
{
//echo "Cannot open file ($installLog)";
ServerResponse(true);
}
// create install information record
$content = "USERNAME=[" . trim($_POST['username']) . "], COMPANYNAME=[" . trim($_POST['company']) . "], EMAIL=[" . trim($_POST['sn']) . "]\n";
// log collected information
if(!fwrite($handle, $content))
{
//echo "Cannot write to file ($installLog)";
}
// close file handle
fclose($handle);
// send response acknolegement to client
ServerResponse();
?>
Let me know if you encounter any problems with this approach. Note that if the PHP file cannot be found, the installation will give an "Invalid Serial Number" message.
This is a temporary solution for what you need to do. In a future version of Advanced Installer we will include a feature which will allow the package to send information to a server.
Regards,
Cosmin
FOLLOW US
Get the latest news in Application Packaging