In several Delphi XE2 projects, I have set up Eurekalog to send bug reports via "HTTP upload" which works well, as I use a PHP script to catch the bug report, save it in a directory and send it to me via email:
<?php
require 'PHPMailerAutoload.php';
foreach ($_FILES as $key => $value)
{
$uploaded_file = $_FILES[$key]['tmp_name'];
$server_dir = 'upload/';
$server_file = $server_dir . date("Y-m-d H-i-s ") . basename($_FILES[$key]['name']);
$ext = strtoupper(pathinfo($server_file, PATHINFO_EXTENSION));
if ($ext != 'EL')
{
continue;
}
if (move_uploaded_file($uploaded_file, $server_file))
{
echo '<html>';
echo '<head>';
echo '<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML; CHARSET=UTF-8">';
echo '<title>Bug submission</title>';
echo '</head>';
echo '<body>';
echo 'Thank you!<br />';
echo "<!--\n";
echo "<EurekaLogReply>Thank you for your feedback!</EurekaLogReply>\n";
echo "-->";
echo '</body>';
echo '</html>';
SendBugReportMessage('[email protected]',
'A User of my program',
'Eurekalog Bug Report',
'This is a bug report from Eurekalog.',
'[email protected]',
$server_file,
basename($server_file)
);
}
}
function SendBugReportMessage($AFrom, $AFromName, $ASubject, $ABodyText, $ARecipient, $AFileToAttach, $ANameOfFile)
{
$email = new PHPMailer();
$email->From = $AFrom;
$email->FromName = $AFromName;
$email->Subject = $ASubject;
$email->Body = $ABodyText;
$email->AddAddress($ARecipient);
$file_to_attach = $AFileToAttach;
$email->AddAttachment($file_to_attach, $ANameOfFile);
return $email->Send();
}
?>
Now I have several programs using this very same PHP script to upload their bug reports. However, the bug report sent to this PHP script has always the name "BugReport". So, in the PHP script how can I get the name of the program which sent the bug report, so I can save it by attaching the program name and include the program name in the mail subject? Or could there be a solution by implementing something on the side of the Delphi code? Or in Eurekalog?
Eurekalog version is 7.1.0.0