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  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
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 / 3
    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


    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! "ebook: Exploring IBM SOA Technology & Practice

    Learn field-tested SOA principles, methodology, technology and implementation from the global SOA market leader - in a new e-book by an IBM SOA expert. Written by IBM Certified SOA Solution Designer Bobby Woolf, "Exploring IBM SOA Technology & Practice" is the ultimate insider's guide to SOA - a PDF e-book packed cover to cover with IBM's specific advice on how to make your SOA implementation a success.
    FREE! Go There Now!


    NEW! Download a free trial of WebSphere Business Modeler Advanced V6.1.1

    Visit IBM developerWorks to download a free trial version of WebSphere Business Modeler Advanced V6.1.1, IBM’s premier business process modeling and analysis tool for business users that offers process modeling, simulation, and analysis capabilities. IBM WebSphere Business Modeler helps you visualize, understand, and document business processes for continuous improvement.
    FREE! Go There Now!


    NEW! Hacking 101

    Join us for this web seminar to learn how you can defend your web applications from attack. Learn about the 3 most common web application attacks, including how they occur and what can be done to prevent them. We’ll also discuss manual versus automated approaches for scanning and identifying web application vulnerabilities and how IBM Rational AppScan, an automated vulnerability scanner, can help you automate more of what you are doing manually today.
    FREE! Go There Now!


    NEW! Rational Modeling Extension for Microsoft.Net

    Rational Modeling Extension for Microsoft .NET enhances usability for code generation supporting a more intelligent refactoring. The latest enhancements enable organizations with Java and .NET systems and software development maintain architectural integrity across heterogeneous platforms.
    FREE! Go There Now!


    NEW! Rational Talks to You: Grady Booch on Architecture

    Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered!
    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!


    NEW! Trial download: IBM Informix Dynamic Server Express Edition V11.0

    Informix Dynamic Server (IDS) Express Edition offers outstanding online transaction processing (OLTP) database performance, while helping to simplify and automate many of the tasks associated with deploying databases for small business applications. IDS 11 further extends the ease of management and applications integration with the Admin API and Scheduler, high availability with Continuous Log Restore for backup server recovery in case of a primary server failure, and column level encryption to protect personal and company private data.
    FREE! Go There Now!


    NEW! Using Rational Business Developer to enhance your developer productivity

    Join this Rational Talks to You teleconference, to hear how Enterprise Generation Language (EGL) eliminates the need for tedious and error-prone low level coding, so developers can focus on business requirements. EGL extends the Rational software development platform with a simplified programming language that enables developers who have little or no experience with Java, Web technologies or Service Oriented Architecture, to create enterprise-class applications and services quickly and easily. It also allows developers who may have little or no mainframe programming experience to quickly create traditional mainframe components.
    FREE! Go There Now!


    NEW! Webcast: What is new in Viper 2 for developers?

    Viper 2 brings a great value to developer communities including SQL, XML, PHP, Ruby, .NET and Java. You probably already know that DB2 Express-C is free for developers to develop, deploy and distribute. Viper 2 provides a variety of means that help move your application from the development stage to deployment more rapidly. This webcast shows how to best utilize the latest tools available for developing DB2 applications.
    FREE! Go There Now!


    NEW! Whitepaper: Achieving consistency between business process models and operational guides

    Explore how Rational and WebSphere software enable enterprise documentation in SOA environments. Specifically, a new integration between IBM WebSphere® Business Modeler and IBM Rational® Method Composer software can help technical writers more easily keep enterprise operations manuals in sync with changes that are made to business processes, resulting in more accurate and timely documentation that benefits the entire enterprise.
    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-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek