<?php
/*  
 * Analysis Console for Intrusion Databases (ACID)
 *
 * Author: Roman Danyliw <rdd@cert.org>, <roman@danyliw.com>
 *
 * Copyright (C) 2000, 2001 Carnegie Mellon University
 * (see the file 'acid_main.php' for license details)
 *
 * Purpose: debugging and logging routines   
 *
 */

function ErrorMessage ($message)
{
   echo '<FONT COLOR="#FF0000">'.$message.'</FONT><P>';
}

function FatalError ($message)
{
   echo '<FONT COLOR="#FF0000"><B>ACID FATAL ERROR:</B> '.$message.'</FONT>';
   die();  
}

function PrintServerInformation()
{
   echo '';
}

function PrintPageHeader()
{
     GLOBAL $HTTP_SERVER_VARS, $DBtype, $ADODB_vers, $HTTP_SESSION_VARS;

   $tmp = session_encode();   

   if ( isset($HTTP_SERVER_VARS['HTTP_REFERER']) )
      $http_referer = $HTTP_SERVER_VARS['HTTP_REFERER'];
   else
      $http_referer = "";
  
   if ( isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']) )
      $http_user_agent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
   else
      $http_user_agent = "";

   if ( isset($HTTP_SERVER_VARS['SERVER_SOFTWARE']) )
      $server_software = $HTTP_SERVER_VARS['SERVER_SOFTWARE'];
   else
      $server_software = "";

   echo "<PRE>
         <B>URL:</B> '".$HTTP_SERVER_VARS["PHP_SELF"]."' (<B>referred by:</B> '".$http_referer."')
         <B>PARAMETERS:</B> '".$HTTP_SERVER_VARS["QUERY_STRING"]."
         <B>CLIENT:</B> ".$http_user_agent."
         <B>SERVER:</B> ".$server_software."
         <B>SERVER HW:</B> ".php_uname()."
         <B>DATABASE TYPE:</B> $DBtype  <B>DB ABSTRACTION VERSION:</B> $ADODB_vers
         <B>PHP VERSION:</B> ".phpversion()."  <B>PHP API:</B> ".php_sapi_name()."
         <B>ACID VERSION:</B> ".$GLOBALS['ACID_VERSION']."
         <B>SESSION ID:</B> ".session_id()."( ".strlen($tmp)." bytes )
         </PRE>"; 
}

function PrintHTTPPost()
{
   GLOBAL $HTTP_POST_VARS;

   echo "<BR><B>HTTP POST Variables</B><PRE>";
   print_r($HTTP_POST_VARS);
   echo "</PRE>";
}

?>