This class is not secure and needs to be modified? Php *** HttpDownLoad *** @ authorsanshiQQ: 35047205 Email: sanshi0815@tom.comMSN: sanshi0815@tom.com *** @ version1.0.020050710 *** @ deprecated1.http download * classHttpDownLoad {var $ rootDomD: jsp; set the download directory, this class is not safe and needs to be modified
/**
* HttpDownLoad
*
* @ AuthorSanshi
QQ: 35047205
Email: sanshi0815@tom.com
MSN: sanshi0815@tom.com
*
* @ Version1.0.0 2005/07/10
*
* @ Deprecated
1. http download
*/
Class HttpDownLoad
{
Var $ rootDom = "D:/jsp/"; // sets the download directory, which must be an absolute path.
Var $ openDir; // open the absolute path
Var $ open; // directory to be opened
Var $ enter = 3; // Set line feed
Var $ table_w = 800; // you can specify the table width.
Var $ p = array (); // sets the directory to store arrays.
Var $ file = array (); // sets the array for storing files.
Var $ link = array (); // sets the array of connected files.
// Constructor
Function HttpDownLoad ()
{
$ This-> getAll ();
$ This-> head ();
$ This-> printArray ($ this-> dir, "directory ");
$ This-> printArray ($ this-> file, "file ");
$ This-> foot ();
}
// Set the output header
Function head ()
{
Echo"
|
"."
Www.litou.com | "."
Author: Sanshi |
"."
Contact Info:Sanshi0815@tom.com | > "."
Q: 35047205 |
";
}
// Set the end.
Function foot ()
{
}
// Obtain the directory to be opened
Function getOpen ()
{
$ Open = $ _ GET ["dir"];
$ This-> open = $ open;
If (! Isset ($ open) | empty ($ open ))
{
$ OpenDir = $ this-> rootDom;
} Else {
$ OpenDir = $ this-> rootDom. $ open ."/";
}
$ This-> openDir = $ openDir;
Return $ openDir;
}
// Split the contents in the directory
Function getAll ()
{
$ OpenDir = $ this-> getOpen ();
$ Handle = opendir ($ openDir );
While ($ allFile = readdir ($ handle ))
{
If (is_dir ($ openDir. $ allFile ))
{
$ This-> dir [] = $ allFile;
} Else if (is_file ($ openDir. $ allFile ))
{
$ This-> file [] = $ allFile;
} Else if (is_link ($ openDir. $ allFile ))
{
$ This-> link [] = $ allFile;
}
}
Closedir ($ handle );
// Echo count ($ this-> dir )."
";
// Echo count ($ this-> file )."
";
// Echo count ($ this-> link )."
";
}
// Check whether it is a directory
Function isDir ($ dir)
{
If (is_dir ($ dir ))
{
Return true;
}
Return false;
}
// Check whether it is a file
Function isFile ($ file)
{
If (is_file ($ file ))
{
Return true;
}
Return false;
}
// Print the array
Function printArray ($ array, $ title)
{
$ J = 0;
If (count ($ array)> 0)
{
Echo"
}
?>
$ Do = new HttpDownLoad ();
?>
";Echo"
|
";Foreach ($ array as $ v){$ V = trim ($ v );If (substr ($ v, 0, 1 )! = "."){ If ($ j % $ this-> enter = 0){Echo"
";}If (! Isset ($ this-> open) | empty ($ this-> open )){$ L = "";} Else {$ L = "/";}If ($ this-> isDir ($ this-> openDir. $ v )){$ Url = $ PHP_SELF ."? Dir = ". $ this-> open. $ l. $ v;$ Color = "# FF0033 ";$ Size = "3 ";} Else if ($ this-> isFile ($ this-> openDir. $ v )){$ Url = $ this-> openDir. $ v;$ Color = "# 0000FF ";$ Size = "5 ";}$ J;Echo"
". $ Title.". $ v ." | ";}} }}