WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : A File Browser Class.To Read Drives,Directories and Files .Files writing is also possible
Categories : PHP, PHP Classes, Filesystem Click here to Update Your Picture
Vivek Ramnath
Date : Aug 07th 2004
Grade : 2 of 5 (graded 8 times)
Viewed : 7609
File : 3971.php
Images : No Images for this code example.
Search : More code by Vivek Ramnath
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 



This class is designed for reading drives ,directories and Files.
Files writing is also possible

Hope this function works well with remote files.(iff u have the permissions to access it)
for entering username & password u can use
http://uname:password@domain.com/ am not sure please check this format
ftp://uname:password@ftp.com/ am not sure please check this format
<?
Class FileBrowser
{
var
$fval=0;
      function
dir_read($f_name) // Function to read directories
         
{
            if (
$handle = opendir($f_name))
              {
               print(
"<html><B>Directory Name:".$f_name."<B><BR>");
               print(
"<B>Files in the  directory:<BR>");
               print(
"<form method=\"POST\" action=\"ex.php\">");
               print(
"<select size=1 name=fname>");
            while (
false !== ($file = readdir($handle)))
                {
                 if (
$fval>1)
                    {
                   if (
is_file($file))
                      {
                     print(
"<option value=\"$f_name"."/$file\" >".$file."</option>\n");
                      }
                   else
                      {
                      print(
"<option value=\"$f_name"."/$file\"><a href=\"dir2box.php?fname=\"$f_name"."$file\">$file</a></option>\n");
                      }
                    }
                else
                   {
                    if (
is_file($file))
                      {
                     print(
"<option value=\"$f_name"."$file\" >".$file."</option>\n");
                      }
                   else
                      {
                      print(
"<option value=\"$f_name"."$file\"><a href=\"dir2box.php?fname=\"$f_name"."$file\">$file</a></option>\n");
                      }
                   }
           
$fval=$fval+1;
        }

        print(
"</select>");
        print(
"<input type=hidden name=path value=$fname>");
        print(
"<input type=\"submit\" value=\"OPEN\" name=B>");
        print(
"</form></html>");
       
closedir($handle);
          }
          else
              {
              print(
"Unknown Error");
              }
          }

         function
file_read($f_name) //Function to Read Files
         
{
         
$kk=$f_name;
         print(
$kk);
         if(
is_dir($kk)!=TRUE && $f_name!="." && $f_name!="..")
            { 
             
$fp=fopen($kk,"r");
             print(
$kk);
             
$dr=file_get_contents($f_name);
             
rewind($fp);
             
fclose($fp);
             print(
"<html><title>Contents of $kk</title><body bgcolor=black >");
             print(
"<font face=Tahoma color=blue><form method=\"POST\" action=save.php><textarea rows=23 name=b1 cols=79> ".$dr." </textarea><input type=\"Submit\" value=Save ><input type=hidden name=path value=$kk>");
             print(
"</form></font></body></html>");
            }
        else if (
is_dir($kk)==TRUE && $f_name!="." &&$f_name!="..")
           {
       
$fname=$kk;
       
FileBrowser::dir_read($fname);
           }
       else if (
$f_name=="."||$f_name=="..")
           {
    print(
"<html>");
    print(
"<script language=\"JavaScript\">history.back(-2)</script>");
    print(
"</html>");
           }
        }
        function
file_save($path) //Function to save the file. The matter stored in the textbox.
   
{
$bb=$path;
$save=$b1;
$pt1=80;
if (
ereg("http://",$bb)|| ereg("ftp://",$bb))
{
$ft=fopen($path,"w",$pt1);
$bw=fwrite($ft,$save,$k);
print(
"<HTML><title>FILE SAVED</title><BODY><font face=Comic Sans color=Blue><b>File Successfully Saved<b></font></body></html>");
}
else
{
$fo=fopen($path,"r");
fseek($fo,0,SEEK_END );
$n=ftell($fo);
print(
"Writing ".$n."Bytes");
fclose($fo);
$fo=fopen($path,"w");
fwrite($fo,$save);
fclose($fo);
print(
"<HTML><title>FILE SAVED</title><BODY><font face=Comic Sans color=Blue><b>File Successfully Saved<b></font></body></html>");
}
    }
}
?>



Class that allows the PHP developer to create and manage UNIX like password files suitable for use as Apache authentication password files.
Categories : HTTP, PHP, PHP Classes, Filesystem
3 lines of Code to extract Tar, Zip, Gzip etc..
Categories : PHP, Filesystem, PHP Classes, Compression
Search and Replace Text : Searches Files for Specified Text and Replaces It by a Given Text
Categories : PHP, PHP Classes, Search, Filesystem
Easy upload class
Categories : PHP Classes, Filesystem, HTTP, PHP
Kcub – is a class that helps programmers in the procedure of uploading, reading and deleting files from a server.
Categories : PHP, PHP Classes, Filesystem
Compare two texts and display a block of text with the differences between them.
Categories : PHP, PHP Classes, Filesystem, Strings, Arrays
Remote Archive (Zip, Tar, Gzip) downloader with FTP and local extration support
Categories : PHP, FTP, Filesystem, PHP Classes, Compression
Bs_IniHandler is a class that can read and write ini-style files (and strings)
Categories : PHP, Filesystem, PHP Classes
An efficient iterative and buffered text file reader
Categories : PHP, Classes and Objects, Filesystem, PHP Classes, Log Files
PHP4 DirectoryIterator Class
Categories : PHP, PHP Classes, Filesystem, Directories
filesplit : Split big text files in multiple small ones
Categories : PHP, Log Files, Filesystem, PHP Classes
PHP Transfer data from text file to Mysql Table
Categories : PHP, PHP Classes, Filesystem, Databases, MySQL
file class , uploade file , download file already uploaded on another website
Categories : PHP, PHP Classes, Filesystem, Web Services
very simple ftp class
Categories : PHP, PHP Classes, FTP
Authorize.net AIM Interface Class v1.0.0
Categories : PHP, PHP Classes, Ecommerce, Payment Gateways
 Shea Sollars wrote :1348
This deserves a low rate. It was not the whole program, the class was not explained, and there are many bugs. Maybe explain what "print("&lt;form method=\"POST\" action=\"ex.php\"&gt;");" is all about, and "print("&lt;option value=\"$f_name"."/$file\"&gt;&lt;a href=\"dir2box.php?fname=\"$f_name"."$file\"&gt;$file&lt;/a&gt;&lt;/option&gt;\n");" is, it would be alot better. I mean, what is "dir2box.php" and "ex.php" all about?!