OSI-Certified logo

Source code of file adm_applog.php
from the Content Management module for Phprojekt.

<?php
// Content Management System module for PHProjekt (CMS4P).
// Copyright 2002-2005 by Mario A. Valdez-Ramirez
// http://www.mariovaldez.net/

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, 
// Boston, MA 02111-1307, USA.

// You can contact Mario A. Valdez-Ramirez by email 
// at mario@mariovaldez.org or paper mail at 
// Olmos 809, San Nicolas, NL. 66495, Mexico.

//session_start();
$file "adm_applog";
$path_pre="../";
$include_path $path_pre "lib/lib.inc.php";
include_once 
$include_path;
include_once (
$path_pre "cm/cm_lib.inc.php");
fcm_load_secdb ($cm_security);
echo 
$cm_html_header;


if (
$cmru) {
  echo 
"<p class=\"setupreturn\"><a class=\"cms\"href=\"" $cmru ".php\">{$cm_text["setup-return"]}</a></p>";
}

if ((
$cm_superuser) && ($cm_superuser == $user_kurz)) {
  echo 
"<p class=\"titletext\">{$cm_text["applog-welcome"]}</p>";

  echo 
"<form class=\"cms\" action=\"adm_applog.php\" method=\"post\">\n";
  echo 
"<input type=\"hidden\" name=\"cmru\" value=\"$cmru\">";
  echo 
"<input class=\"cms\" type=\"text\" name=\"cm_search_term\" value=\"$cm_search_term\">\n";
  echo 
"<select class=\"cms\" name=\"cm_search_field\">\n";
  echo 
"  <option class=\"cms\" value=\"date\"";
  if (
$cm_search_field == "date") echo " selected";
  echo 
">{$cm_text["applog-date"]}</option>\n";
  echo 
"  <option class=\"cms\" value=\"operation\"";
  if (
$cm_search_field == "operation") echo " selected";
  echo 
">{$cm_text["applog-operation"]}</option>\n";
  echo 
"  <option class=\"cms\" value=\"user\"";
  if (
$cm_search_field == "user") echo " selected";
  echo 
">{$cm_text["applog-user"]}</option>\n";
  echo 
"  <option class=\"cms\" value=\"directory\"";
  if (
$cm_search_field == "directory") echo " selected";
  echo 
">{$cm_text["applog-directory"]}</option>\n";
  echo 
"  <option class=\"cms\" value=\"description\"";
  if (
$cm_search_field == "description") echo " selected";
  echo 
">{$cm_text["applog-description"]}</option>\n";
  echo 
"</select>\n";
  echo 
"<button class=\"cms\" type=\"submit\" name=\"cm_search\">{$cm_text["search"]}</button>\n";
  echo 
"</form><hr>\n";

  if ((
$cm_search_term) && ($cm_search_field)) {
    
$cm_where "";
    switch (
$cm_search_field) {
      case 
"date":
        
$cm_where "where cmdb_date like '%$cm_search_term%'";
        break;
      case 
"operation":
        
$cm_where "where cmdb_operation like '%$cm_search_term%'";
        break;
      case 
"user":
        
$cm_where "where cmdb_user like '%$cm_search_term%'";
        break;
      case 
"directory":
        
$cm_where "where cmdb_directory like '%$cm_search_term%'";
        break;
      case 
"description":
        
$cm_where "where cmdb_description like '%$cm_search_term%'";
        break;
    }
    
$result1 db_query("select id, cmdb_date, cmdb_operation, cmdb_user, cmdb_directory, cmdb_description from " CM_DB_PREFIX "cmapplog3 $cm_where order by id") or db_die();
    echo 
"<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\">";
    echo 
"<tr><td class=\"applog1header\">{$cm_text["applog-id"]}</td><td class=\"applog1header\">{$cm_text["applog-date"]}</td><td class=\"applog1header\">{$cm_text["applog-operation"]}</td><td class=\"applog1header\">{$cm_text["applog-user"]}</td><td class=\"applog1header\">{$cm_text["applog-directory"]}</td><td class=\"applog1header\">{$cm_text["applog-description"]}</td></tr>";
    
$cm_curcolor "applistcolor1";
    while (
$row1 db_fetch_row($result1)) {
      echo 
"<tr class=\"$cm_curcolor\">";
      echo 
"<td class=\"applog1body\">$row1[0]</td>";
      echo 
"<td class=\"applog1body\" nowrap>$row1[1]</td>";
      echo 
"<td class=\"applog1body\" align=\"center\">$row1[2]</td>";
      echo 
"<td class=\"applog1body\" align=\"center\">$row1[3]</td>";
      echo 
"<td class=\"applog1body\">$row1[4]</td>";
      echo 
"<td class=\"applog1body\">$row1[5]</td>";
      echo 
"</tr>";
      
$cm_curcolor fcm_swap_rowcolor ($cm_curcolor"applistcolor1""applistcolor2");
    }
    echo 
"</table>";

    
fcm_add_logentry (""$user_kurzCM_APPLOG_INFO"Applog viewer executed.");
  }



}
else {
  echo 
"<p class=\"titletext\">{$cm_text["applog-welcome"]}</p>";
  echo 
"<p class=\"generaltext\">{$cm_text["setup-currentuser"]} <strong>$user_kurz</strong><br>";
  echo 
"{$cm_text["setup-superuseris"]} <strong>$cm_superuser</strong></p>";
  echo 
"<h3 class=\"setuperror\">{$cm_text["applog-nosuperuser"]}</h3>";
  
fcm_add_logentry (""$user_kurzCM_APPLOG_ERROR"Error when viewing applog. Not enough permissions.");
}

if (
$cmru) {
  echo 
"<p class=\"setupreturn\"><a class=\"cms\"href=\"" $cmru ".php\">{$cm_text["setup-return"]}</a></p>";
}

echo 
$cm_html_footer;
?>

 
 
NA fum/lmd: 2004.09.16
Copyright ©1994-2018 by Mario A. Valdez-Ramírez.
no siga este enlace / do not follow this link