📄 netdisk.php
字号:
<?php
function connecte( $id )
{
global $installurl;
global $users;
global $HTTP_REFERER;
$retour = 0;
if ( $users == 0 )
{
$retour = 1;
}
else if ( $id != "" )
{
if ( file_exists( "logs/{$id}.php" ) )
{
$retour = 1;
}
if ( !eregi( "{$installurl}", $HTTP_REFERER ) )
{
$retour = 0;
}
}
return $retour;
}
function is_editable( $fichier )
{
$retour = 0;
if ( eregi( "\\.txt\$|\\.sql\$|\\.php\$|\\.phtml\$|\\.htm\$|\\.html\$|\\.cgi\$|\\.pl\$|\\.js\$|\\.css\$|\\.inc\$", $fichier ) )
{
$retour = 1;
}
return $retour;
}
function is_image( $fichier )
{
$retour = 0;
if ( eregi( "\\.png\$|\\.bmp\$|\\.jpg\$|\\.jpeg\$|\\.gif\$|\\.swf\$|\\.midi\$|\\.doc\$|\\.xls\$|\\.ppt\$\$", $fichier ) )
{
$retour = 1;
}
return $retour;
}
function creer_id( $chemin, $url, $user )
{
global $id;
$taille = 20;
$lettres = "abcdefghijklmnopqrstuvwxyz0123456789";
srand( time( ) );
$i = 0;
for ( ; $i < $taille; ++$i )
{
$id .= substr( $lettres, rand( ) % strlen( $lettres ), 1 );
}
$fp = fopen( "logs/{$id}.php", "w" );
if ( $fp )
{
fputs( $fp, "<? \$racine=\"{$chemin}\"; \$url_racine=\"{$url}\"; \$user=\"{$user}\"; ?>" );
fclose( $fp );
}
else
{
exit( );
}
}
function taille( $fichier )
{
global $size_unit;
$taille = filesize( $fichier );
if ( 1073741824 <= $taille )
{
$taille = ( round( $taille / 1073741824 * 100 ) / 100 )." G".$size_unit;
}
else if ( 1048576 <= $taille )
{
$taille = ( round( $taille / 1048576 * 100 ) / 100 )." M".$size_unit;
}
else if ( 1024 <= $taille )
{
$taille = ( round( $taille / 1024 * 100 ) / 100 )." K".$size_unit;
}
else
{
$taille = $taille." ".$size_unit;
}
if ( $taille == 0 )
{
$taille = "-";
}
return $taille;
}
function date_modif( $fichier )
{
$tmp = filemtime( $fichier );
return date( "Y-m-d H:i:s", $tmp );
}
function mimetype( $fichier, $quoi )
{
global $mess;
global $HTTP_USER_AGENT;
if ( !eregi( "MSIE", $HTTP_USER_AGENT ) )
{
$client = "netscape.gif";
}
else
{
$client = "html.gif";
}
if ( is_dir( $fichier ) )
{
$image = "dossier.gif";
$nom_type = $mess[8];
}
else if ( eregi( "\\.mid\$", $fichier ) )
{
$image = "mid.gif";
$nom_type = $mess[9];
}
else if ( eregi( "\\.txt\$", $fichier ) )
{
$image = "txt.gif";
$nom_type = $mess[10];
}
else if ( eregi( "\\.sql\$", $fichier ) )
{
$image = "txt.gif";
$nom_type = $mess[10];
}
else if ( eregi( "\\.js\$", $fichier ) )
{
$image = "js.gif";
$nom_type = $mess[11];
}
else if ( eregi( "\\.gif\$", $fichier ) )
{
$image = "gif.gif";
$nom_type = $mess[12];
}
else if ( eregi( "\\.jpg\$", $fichier ) )
{
$image = "jpg.gif";
$nom_type = $mess[13];
}
else if ( eregi( "\\.html\$", $fichier ) )
{
$image = $client;
$nom_type = $mess[14];
}
else if ( eregi( "\\.htm\$", $fichier ) )
{
$image = $client;
$nom_type = $mess[15];
}
else if ( eregi( "\\.rar\$", $fichier ) )
{
$image = "rar.gif";
$nom_type = $mess[60];
}
else if ( eregi( "\\.gz\$", $fichier ) )
{
$image = "zip.gif";
$nom_type = $mess[61];
}
else if ( eregi( "\\.tgz\$", $fichier ) )
{
$image = "zip.gif";
$nom_type = $mess[61];
}
else if ( eregi( "\\.z\$", $fichier ) )
{
$image = "zip.gif";
$nom_type = $mess[61];
}
else if ( eregi( "\\.ra\$", $fichier ) )
{
$image = "ram.gif";
$nom_type = $mess[16];
}
else if ( eregi( "\\.ram\$", $fichier ) )
{
$image = "ram.gif";
$nom_type = $mess[17];
}
else if ( eregi( "\\.rm\$", $fichier ) )
{
$image = "ram.gif";
$nom_type = $mess[17];
}
else if ( eregi( "\\.pl\$", $fichier ) )
{
$image = "pl.gif";
$nom_type = $mess[18];
}
else if ( eregi( "\\.zip\$", $fichier ) )
{
$image = "zip.gif";
$nom_type = $mess[19];
}
else if ( eregi( "\\.wav\$", $fichier ) )
{
$image = "wav.gif";
$nom_type = $mess[20];
}
else if ( eregi( "\\.php\$", $fichier ) )
{
$image = "php.gif";
$nom_type = $mess[22];
}
else if ( eregi( "\\.phtml\$", $fichier ) )
{
$image = "php.gif";
$nom_type = $mess[22];
}
else if ( eregi( "\\.exe\$", $fichier ) )
{
$image = "exe.gif";
$nom_type = $mess[50];
}
else if ( eregi( "\\.bmp\$", $fichier ) )
{
$image = "bmp.gif";
$nom_type = $mess[56];
}
else if ( eregi( "\\.png\$", $fichier ) )
{
$image = "gif.gif";
$nom_type = $mess[57];
}
else if ( eregi( "\\.css\$", $fichier ) )
{
$image = "css.gif";
$nom_type = $mess[58];
}
else if ( eregi( "\\.mp3\$", $fichier ) )
{
$image = "mp3.gif";
$nom_type = $mess[59];
}
else if ( eregi( "\\.xls\$", $fichier ) )
{
$image = "xls.gif";
$nom_type = $mess[64];
}
else if ( eregi( "\\.doc\$", $fichier ) )
{
$image = "doc.gif";
$nom_type = $mess[65];
}
else if ( eregi( "\\.pdf\$", $fichier ) )
{
$image = "pdf.gif";
$nom_type = $mess[79];
}
else if ( eregi( "\\.mov\$", $fichier ) )
{
$image = "mov.gif";
$nom_type = $mess[80];
}
else if ( eregi( "\\.avi\$", $fichier ) )
{
$image = "avi.gif";
$nom_type = $mess[81];
}
else if ( eregi( "\\.mpg\$", $fichier ) )
{
$image = "mpg.gif";
$nom_type = $mess[82];
}
else if ( eregi( "\\.mpeg\$", $fichier ) )
{
$image = "mpeg.gif";
$nom_type = $mess[83];
}
else if ( eregi( "\\.swf\$", $fichier ) )
{
$image = "flash.gif";
$nom_type = $mess[91];
}
else
{
$image = "defaut.gif";
$nom_type = $mess[23];
}
if ( $quoi == "image" )
{
return $image;
}
else
{
return $nom_type;
}
}
function init( $rep )
{
global $racine;
global $sens;
global $mess;
global $font;
global $DISK_ID;
if ( $rep == "" )
{
$nom_rep = $racine;
}
if ( $sens == "" )
{
$sens = 1;
}
else if ( $sens == 1 )
{
$sens = 0;
}
else
{
$sens = 1;
}
if ( $rep != "" )
{
$nom_rep = "{$racine}/{$rep}";
}
if ( !file_exists( $racine ) )
{
echo "{$mess['72']}<br><br><a href=\"netdisk.php\"><span class=Big1>{$mess['32']}</span></a>\n";
exit( );
}
if ( !is_dir( $nom_rep ) )
{
echo "{$mess['76']}<br><br><a href=\"javascript:window.history.back()\"><span class=Big1>{$mess['32']}</span></a>\n";
exit( );
}
return $nom_rep;
}
function assemble_tableaux( $t1, $t2 )
{
global $sens;
if ( $sens == 0 )
{
$tab1 = $t1;
$tab2 = $t2;
}
else
{
$tab1 = $t2;
$tab2 = $t1;
}
if ( is_array( $tab1 ) )
{
while ( list( $cle, $val ) = each( $tab1 ) )
{
$liste[$cle] = $val;
}
}
if ( is_array( $tab2 ) )
{
while ( list( $cle, $val ) = each( $tab2 ) )
{
$liste[$cle] = $val;
}
}
return $liste;
}
function txt_vers_html( $chaine )
{
$chaine = str_replace( "‘", "'", $chaine );
$chaine = str_replace( "œ", "oe", $chaine );
$chaine = str_replace( "’", "'", $chaine );
$chaine = str_replace( "…", "...", $chaine );
$chaine = str_replace( "&", "&", $chaine );
$chaine = str_replace( "<", "<", $chaine );
$chaine = str_replace( ">", ">", $chaine );
$chaine = str_replace( "\"", """, $chaine );
return $chaine;
}
function show_hidden_files( $fichier )
{
global $showhidden;
$retour = 1;
if ( substr( $fichier, 0, 1 ) == "." && $showhidden == 0 )
{
$retour = 0;
}
return $retour;
}
function listing( $nom_rep )
{
global $sens;
global $ordre;
global $size_unit;
$poidstotal = 0;
$handle = opendir( $nom_rep );
while ( $fichier = readdir( $handle ) )
{
if ( $fichier != "." && $fichier != ".." && show_hidden_files( $fichier ) == 1 )
{
$poidsfic = filesize( "{$nom_rep}/{$fichier}" );
$poidstotal += $poidsfic;
if ( is_dir( "{$nom_rep}/{$fichier}" ) )
{
if ( $ordre == "mod" )
{
$liste_rep[$fichier] = filemtime( "{$nom_rep}/{$fichier}" );
}
else
{
$liste_rep[$fichier] = $fichier;
}
}
else if ( $ordre == "nom" )
{
$liste_fic[$fichier] = mimetype( "{$nom_rep}/{$fichier}", "image" );
}
else if ( $ordre == "taille" )
{
$liste_fic[$fichier] = $poidsfic;
}
else if ( $ordre == "mod" )
{
$liste_fic[$fichier] = filemtime( "{$nom_rep}/{$fichier}" );
}
else if ( $ordre == "type" )
{
$liste_fic[$fichier] = mimetype( "{$nom_rep}/{$fichier}", "type" );
}
else
{
$liste_fic[$fichier] = mimetype( "{$nom_rep}/{$fichier}", "image" );
}
}
}
closedir( $handle );
if ( is_array( $liste_fic ) )
{
if ( $ordre == "nom" )
{
if ( $sens == 0 )
{
ksort( $liste_fic );
}
else
{
krsort( $liste_fic );
}
}
else if ( $ordre == "mod" )
{
if ( $sens == 0 )
{
arsort( $liste_fic );
}
else
{
asort( $liste_fic );
}
}
else if ( $ordre == "taille" || $ordre == "type" )
{
if ( $sens == 0 )
{
asort( $liste_fic );
}
else
{
arsort( $liste_fic );
}
}
else if ( $sens == 0 )
{
ksort( $liste_fic );
}
else
{
krsort( $liste_fic );
}
}
if ( is_array( $liste_rep ) )
{
if ( $ordre == "mod" )
{
if ( $sens == 0 )
{
arsort( $liste_rep );
}
else
{
asort( $liste_rep );
}
}
else if ( $sens == 0 )
{
ksort( $liste_rep );
}
else
{
krsort( $liste_rep );
}
}
$liste = assemble_tableaux( $liste_rep, $liste_fic );
if ( 1073741824 <= $poidstotal )
{
$poidstotal = ( round( $poidstotal / 1073741824 * 100 ) / 100 )." G".$size_unit;
}
else if ( 1048576 <= $poidstotal )
{
$poidstotal = ( round( $poidstotal / 1048576 * 100 ) / 100 )." M".$size_unit;
}
else if ( 1024 <= $poidstotal )
{
$poidstotal = ( round( $poidstotal / 1024 * 100 ) / 100 )." K".$size_unit;
}
else
{
$poidstotal = $poidstotal." ".$size_unit;
}
return array(
$liste,
$poidstotal
);
}
function contenu_dir( $nom_rep )
{
global $font;
global $id;
global $sens;
global $ordre;
global $rep;
global $poidstotal;
global $MANAGE_USER;
global $LOGIN_USER_ID;
global $DISK_ID;
list( $liste, $poidstotal ) = listing( $nom_rep );
if ( is_array( $liste ) )
{
$LINE_COUNT = 0;
while ( list( $fichier, $mime ) = each( $liste ) )
{
if ( is_dir( "{$nom_rep}/{$fichier}" ) )
{
$lien = "netdisk.php?DISK_ID={$DISK_ID}&sens={$sens}&ordre={$ordre}&rep=";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -