Http download class (for users)

Source: Internet
Author: User
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 ."

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.