Skip to main content
Participating Frequently
September 24, 2010
Answered

Local server reporting with ASP

  • September 24, 2010
  • 2 replies
  • 979 views

Hi guys,

I'm running Captivate 4 at the moment and using email reporting to get results and a very crude process to get all the interactions into a database. So we're looking at Captivate 5 and considering if its worth purchasing. I could download the trial and test it myself if the IT department would just give me access to administrator rights to my computer and control of the SQL database.

I'm interested to find out if anyone has done an ASP solution for this? And if you could send it to me that would be great. Unfortunately my organisation only uses the Windows/.NET framework and has no PHP capabilities.

If not, if someone could send me a sample of the auto generated "InternalServerReporting.php", that would help as well. I simply can't find any details of how the data is passed to the PHP script. I have some knowledge of PHP so I should be able to work it out looking at the script.

Regards,

Dennis

This topic has been closed for replies.
Correct answer McCoyCorp

Hey Dennis:

I have attached both PHP files within the Template directory.

<?php # InternalServerReporting.php
# Copyright 2000-2008 Adobe Systems Incorporated. All rights reserved.
#
   print "<pre>\n";

#
   foreach ($_POST as $k => $v)
   {
         if($k == "CompanyName")
       {
         $CompanyName = $v;
      }
      if($k == "DepartmentName")
       {
         $DepartmentName = $v;
      }
      if($k == "CourseName")
       {
         $CourseName = $v;
      }
      if($k == "Filename")
      {
           $Filename = $v;
      }
      if($k == "Filedata")
      {
           if(get_magic_quotes_gpc())
          $Filedata = stripslashes($v);
          else
          $Filedata = $v;
      }
   }

     $ResultFolder = "./"."CaptivateResults";
     mkdir($ResultFolder);
     $CompanyFolder = $ResultFolder."//".$CompanyName;
     mkdir($CompanyFolder);
     $DepartmentFolder = $CompanyFolder."//".$DepartmentName;
     mkdir($DepartmentFolder);
     $CourseFolder = $DepartmentFolder."//".$CourseName;
     mkdir($CourseFolder);
     $FilePath = $CourseFolder."//".$Filename;
     $Handle = fopen($FilePath, 'w');
     fwrite($Handle, $Filedata);
     fclose($Handle);


   print "</pre>\n";
?>

<?php
switch($_POST['API'])
{
     case 1: getCompanies();
               break;
     case 2: getDepartments($_POST['company']);
               break;
     case 3: getCourses($_POST['company'],$_POST['department']);
               break;
     case 4: getXMLs($_POST['company'],$_POST['department'],$_POST['course']);
               break;
     case 5: downloadXML($_POST['company'],$_POST['department'],$_POST['course'],$_POST['xmlname']);
               break;
     default:break;
}
function getCompanies()
{
     $dir = @opendir("CaptivateResults");
     if($dir != "")
     {
          while(($file = readdir($dir)) !== false)
          {
               if(!is_file($file))
               echo $file.";";
          }
          closedir($dir);
     }
     else
     echo "No Captivate Results found;";
}
function getDepartments($comp)
{
     $dir = @opendir("CaptivateResults"."/".$comp);
     while (($file = readdir($dir)) !== false)
     {
          if(!is_file($file))
          echo $file.";";
     }
     closedir($dir);
}
function getCourses($comp,$dept)
{
     $dir = @opendir("CaptivateResults"."/".$comp."/".$dept);
     while (($file = readdir($dir)) !== false)
     {
          if(!is_file($file))
          echo $file.";";
     }
     closedir($dir);
}
function getXMLs($comp,$dept,$course)
{
     $dir = @opendir("CaptivateResults"."/".$comp."/".$dept."/".$course);
     $directory = "CaptivateResults"."/".$comp."/".$dept."/".$course;
     while (($file = readdir($dir)) !== false)
     {
          if(!(is_dir($file)) && findexts($file) == 'xml')
          {
               echo $file.",".number_format(filectime($directory."/".$file),0, '.', '').";";
          }
     }
     closedir($dir);
}
function downloadXML($comp,$dept,$course,$name)
{
     $dir = "CaptivateResults"."/".$comp."/".$dept."/".$course."/".$name;
     $handle = fopen($dir, "r");
     $contents = fread($handle, filesize($dir));
     fclose($handle);
     echo $contents;
}
function findexts ($filename)
{
     $filename = strtolower($filename) ;
     $exts = explode(".", $filename);
     $n = count($exts)-1;
     $exts = $exts[$n];
     return $exts;
}
?>

2 replies

McCoyCorpCorrect answer
Inspiring
November 3, 2010

Hey Dennis:

I have attached both PHP files within the Template directory.

<?php # InternalServerReporting.php
# Copyright 2000-2008 Adobe Systems Incorporated. All rights reserved.
#
   print "<pre>\n";

#
   foreach ($_POST as $k => $v)
   {
         if($k == "CompanyName")
       {
         $CompanyName = $v;
      }
      if($k == "DepartmentName")
       {
         $DepartmentName = $v;
      }
      if($k == "CourseName")
       {
         $CourseName = $v;
      }
      if($k == "Filename")
      {
           $Filename = $v;
      }
      if($k == "Filedata")
      {
           if(get_magic_quotes_gpc())
          $Filedata = stripslashes($v);
          else
          $Filedata = $v;
      }
   }

     $ResultFolder = "./"."CaptivateResults";
     mkdir($ResultFolder);
     $CompanyFolder = $ResultFolder."//".$CompanyName;
     mkdir($CompanyFolder);
     $DepartmentFolder = $CompanyFolder."//".$DepartmentName;
     mkdir($DepartmentFolder);
     $CourseFolder = $DepartmentFolder."//".$CourseName;
     mkdir($CourseFolder);
     $FilePath = $CourseFolder."//".$Filename;
     $Handle = fopen($FilePath, 'w');
     fwrite($Handle, $Filedata);
     fclose($Handle);


   print "</pre>\n";
?>

<?php
switch($_POST['API'])
{
     case 1: getCompanies();
               break;
     case 2: getDepartments($_POST['company']);
               break;
     case 3: getCourses($_POST['company'],$_POST['department']);
               break;
     case 4: getXMLs($_POST['company'],$_POST['department'],$_POST['course']);
               break;
     case 5: downloadXML($_POST['company'],$_POST['department'],$_POST['course'],$_POST['xmlname']);
               break;
     default:break;
}
function getCompanies()
{
     $dir = @opendir("CaptivateResults");
     if($dir != "")
     {
          while(($file = readdir($dir)) !== false)
          {
               if(!is_file($file))
               echo $file.";";
          }
          closedir($dir);
     }
     else
     echo "No Captivate Results found;";
}
function getDepartments($comp)
{
     $dir = @opendir("CaptivateResults"."/".$comp);
     while (($file = readdir($dir)) !== false)
     {
          if(!is_file($file))
          echo $file.";";
     }
     closedir($dir);
}
function getCourses($comp,$dept)
{
     $dir = @opendir("CaptivateResults"."/".$comp."/".$dept);
     while (($file = readdir($dir)) !== false)
     {
          if(!is_file($file))
          echo $file.";";
     }
     closedir($dir);
}
function getXMLs($comp,$dept,$course)
{
     $dir = @opendir("CaptivateResults"."/".$comp."/".$dept."/".$course);
     $directory = "CaptivateResults"."/".$comp."/".$dept."/".$course;
     while (($file = readdir($dir)) !== false)
     {
          if(!(is_dir($file)) && findexts($file) == 'xml')
          {
               echo $file.",".number_format(filectime($directory."/".$file),0, '.', '').";";
          }
     }
     closedir($dir);
}
function downloadXML($comp,$dept,$course,$name)
{
     $dir = "CaptivateResults"."/".$comp."/".$dept."/".$course."/".$name;
     $handle = fopen($dir, "r");
     $contents = fread($handle, filesize($dir));
     fclose($handle);
     echo $contents;
}
function findexts ($filename)
{
     $filename = strtolower($filename) ;
     $exts = explode(".", $filename);
     $n = count($exts)-1;
     $exts = $exts[$n];
     return $exts;
}
?>

September 24, 2010

Hi Dennis,

The sample "InternalServerReporting.php","internalServerReporting.php" are located @ cp5 installfolder/Templates/Publish

Thanks,

Deepak

Participating Frequently
September 24, 2010

Hi Deepak,

Thank you for your reply.

Yes, I do know that. However, as I've mentioned, I'm not able to install CP5. It would help if I could, but I've got to go through whole layers of red tape. I'm gonna have to jump through hoops and do backflips just to get the trial installed. I'd rather do that only once after purchasing.

Regards,

Dennis Tng