File Manipulation Code
  Home arrow File Manipulation Code arrow Error Log Finder
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Forums Sitemap 
Dedicated Servers  
Download TestComplete 
IBM® developerWorks
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
FILE MANIPULATION CODE

Error Log Finder
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2003-05-13

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Script to find error log files (specified by php.ini) at and below current directory. With option to view or delete files.

    By : opus006

    <html><body>
    <?php
    /*
    script: FindErrLog
    by: Wayne Nelson
    for: codewalkers code forum

    scrip to display all error logs at, or below current directory.
    Uses log file specified in php.ini: error_log=XXXXXXXXXX

    */

    function GetListArray( $fileRoot, $matchFile, $isWin) {
    $foundList = array();
    $subList = array();
    $filePath = ""; //file path relative to current file $ web directories
    $path = $fileRoot;
    do {
    $path = $fileRoot.$filePath;
    $Hdir = opendir($path);
    if ($Hdir) {
    while (false !== ($file = readdir($Hdir))) {
    if (($file != '.') && ($file != '..')) {
    if ($isWin) {
    if ($file === $matchFile)
    array_push($foundList, $filePath."\\".$file);
    if (is_dir( $fileRoot.$filePath."\\".$file ))
    array_push($subList, $filePath."\\".$file);
    } // if isWin
    else {
    if ($file === $matchFile)
    array_push($foundList, $filePath.'/'.$file);
    if (is_dir( $fileRoot.$filePath.'/'.$file ))
    array_push($subList, $filePath.'/'.$file);
    } // else isWin
    } // if . or ..
    } // while file
    }// if Hdir
    $continue= false;
    if (list($key, $val)= each($subList)) {
    $continue=true;
    $filePath = $val;
    array_shift($subList);
    } // if subList
    } while ($continue);
    sort($foundList);
    return $foundList;
    } // GetListArray function;

    //###############################
    // main code
    //###############################
    if (isset($_GET['delete'])) {
    $tmp = $_GET['delete'];
    // var_dump($tmp);
    unlink($tmp);
    }
    $errFile = ini_get('error_log');

    $me = $_SERVER['SCRIPT_NAME'];
    $sub = substr( $_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
    $webRoot = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$sub;

    $dirRoot = getcwd();
    $isWin = (strrpos($dirRoot, '\\')=== FALSE) ? FALSE : TRUE;

    $List = GetListArray( $dirRoot, $errFile, $isWin);

    ?>
    <table width="100%" border="1" cellspacing="2" cellpadding="0">
    <tr>
    <td></td>
    <td><p>List of all log files (specified by "error_log" in php.ini file) at or below the current directory.</p>
    <?php
    print "<p>error_log setting: $errFile</p>\n";
    print "<p>current web directory: $webRoot</p>\n";
    print "<p>current file direcory: $dirRoot</p>\n";
    foreach ($List as $dir){
    $tmp = str_replace("\\", '/', $dir);
    $ds = $me.'?delete='.$dirRoot.$dir;
    print '<tr><td><a href="'.$webRoot.$tmp.'" target="_blank">view</a></td><td>'.$dir.'</td><td><a href="'.$ds.'">delete</a></td></tr>'."\n";
    } // foreach list
    print '<tr><td></td><td><form action ="'.$me.'" method="get" name="FindErrLog">'."\n";
    ?>
    <p><input type="submit" name="bnStart" value="Search" border="0"></p>
    </form></td>
    </table>
    </body>
    </html>
    <?php
    flush();
    exit;
    ?>

    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More File Manipulation Code Articles
    More By Codewalkers

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Driving Business Success with Rational Process Library

    Join this webcast, to learn how the Rational Process Library can help with compliance issues, drive process improvement, and assist in service-oriented architecture (SOA) or Agile development. We will take a peek into the Rational Process Library with content around software and systems engineering (including RUP), operations and systems management, program and portfolio management, and asset and SOA governance.
    FREE! Go There Now!


    NEW! IBM – Taking Web 2.0 to Work

    David Barnes, Lead Evangelist for IBM Emerging Internet Technologies will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve.
    FREE! Go There Now!


    NEW! Best practices for software analysis: An introduction to the IBM Rational Software Analyzer application

    This whitepaper presents the benefits of successfully introducing static analysis into your organization using IBM Rational Software Analyzer. Additionally, it identifies some common pitfalls that can hinder the effective use of static analysis tooling as well as presents 10 simple strategies designed to help you quickly realize the value of static analysis using Rational Software Analyzer.
    FREE! Go There Now!


    NEW! Evaluate IBM Rational Developer for System i V7.1

    Download a free trial version of IBM Rational Developer for System i V7.1, which provides a complete development environment for traditional i5/OS application development. IBM Rational Developer for System i is a new eclipse-based workstation offering for i5/OS application development that provides a comprehensive Integrated Development Environment for edit/compile/debug of traditional RPG/COBOL/C/C++ i5/OS applications.
    FREE! Go There Now!


    NEW! Info 2.0: Harnessing the power of Web 2.0 and Enterprise Mashups

    Listen to this webcast to get an overview of Info 2.0 and a technical demo of how to quickly build an enterprise mashup. IBM's Info 2.0 technology leverages emerging Web 2.0 technologies such as mashups, feeds, AJAX, and JSON in order to simplify assembly of information using feeds and services. Come learn about the technical elements of Info 2.0 including the Feed Generation framework, Mashup Engine, and mashup assembly components. Learn how to pull information from databases, departmental information, and the Web to create mashups critical to your company’s success. We will also discuss best practices to help you get started.
    FREE! Go There Now!


    NEW! Integrating XML into Your Enterprise Using Data Federation

    XML has become a common way of storing business data as flat files and many data server vendors including IBM have provided ways to store this data within relational database systems. Increasingly collections of XML files are accessed like databases using an xQuery and other XML standard mechanisms. Businesses find the need to combine the traditional tabular structured data with XML formatted data. In this webcast, you’ll learn about IBM’s WebSphere Federation Server technology, which provides users with the ability to integrate these two data formats.
    FREE! Go There Now!


    NEW! Maintaining QoS and Process Integrity in an SOA Environment

    This webcast outlines the best practices that must be instituted to gain the maximum benefit from SOA while maintaining high quality of service. Whether you are deploying new applications or managing and monitoring your existing infrastructure, learn how you can ensure high quality of services with SOA based solutions from IBM. All registrants who attend this live Web Seminar will receive complimentary access to a white paper titled “Maintaining QoS in an SOA Environment”.
    FREE! Go There Now!


    NEW! Rational Talks to You: Scott Ambler on being agile in a global development environment

    Join this Rational Talks to You teleconference on December 6 at 1:00 pm ET to participate in an agile application development discussion and get your questions answered on using IBM Rational Method Composer in a distributed environment.Get your questions answered!
    FREE! Go There Now!


    NEW! The dirty dozen: preventing common application-level hack attacks

    As organizations have grown increasingly dependent on online software, the risk of malicious attacks has also become far more serious. Fortunately, well-governed organizations can protect their Web applications by injecting vulnerability assessments and ethical hacks into their software development and delivery processes. This paper describes 12 of the most common hacker attacks and provides basic rules that you can follow to help create more hack-resistant Web applications.
    FREE! Go There Now!


    NEW! The role of integrated requirements management in software delivery

    This paper is about the critical role that a discipline called integrated require­ments management can play in helping to ensure that your business goals and IT investments are continuously aligned—whether you are sourcing, integrat­ing, building or maintaining software. It also looks at ways that automated IBM Rational® products can work together to help you use requirements in the very best way.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    FILE MANIPULATION CODE ARTICLES

    - Bandwidth Control with pure PHP
    - Eazy Gallery
    - file_get_contents for PHP < 4.3.0
    - PHP Class: Image Snapshot 1.3
    - Universal downloader
    - Image Gallery v2.0
    - Free/Used Disk Space
    - Directory Lister
    - Directory image view, with selective hidden
    - Move or Copy a Directory (and files and sub ...
    - Ensure_Sub_Directory_Exists
    - Wedit
    - Form Examples Text Boxes to Drop Downs
    - myFiles
    - List files in a directory, no subdirectories






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway