Código PHP:
<?php
include("variables.php");
include("admin/config.php");
# header & title of this file
$title = "MI_PAGINA";
# individual file size limit - in bytes (102400 bytes = 100KB)
$file_size_ind = "99999";
# the upload store directory (chmod 777)
$dir_store= "upload/store";
# the images directory
$dir_img= "upload/img";
# the style-sheet file to use (located in the "img" directory, excluding .css)
$style = "style-def";
# the file type extensions allowed to be uploaded
$file_ext_allow = array("gif","jpg","jpeg","png","txt","nfo","doc","rtf","htm","dmg","zip","rar","gz","exe");
# option to display the file list
# to enable/disable, enter '1' to ENABLE or '0' to DISABLE (without quotes)
$file_list_allow = 1;
# option to allow file deletion
# to enable/disable, enter '1' to ENABLE or '0' to DISABLE (without quotes)
$file_del_allow = 1;
# option to password-protect this script [-part1]
# to enable/disable, enter '1' to ENABLE or '0' to DISABLE (without quotes)
$auth_ReqPass = 1;
# option to password-protect this script [-part2]
# if "$auth_ReqPass" is enabled you must set the username and password
$auth_usern = "NOMBRE";
$auth_passw = "PASSWORD";
################ end of configurations ###############
# DO NOT ALTER OR EDIT BELOW THIS LINE UNLESS YOU ARE AN ADVANCED PHP PROGRAMMER
?>
<?
if (@phpversion() < '4.1.0') {
$_FILE = $HTTP_POST_FILES;
$_GET = $HTTP_GET_VARS;
$_POST = $HTTP_POST_VARS;
}
clearstatcache();
error_reporting(E_ALL & ~E_NOTICE);
$fum_vers = "1.3"; # do not edit this line, the script will not work!!!
$fum_info_full = "File Upload Manager v$fum_vers";
function authDo($auth_userToCheck, $auth_passToCheck)
{
global $auth_usern, $auth_passw;
$auth_encodedPass = md5($auth_passw);
if ($auth_userToCheck == $auth_usern && $auth_passToCheck == $auth_encodedPass) {
$auth_check = TRUE;
} else {
$auth_check = FALSE;
}
return $auth_check;
}
if (isset($logout)) {
setcookie ('fum_user', "",time()-3600);
setcookie ('fum_pass', "",time()-3600);
}
if (isset($login)) {
$auth_password_en = md5($auth_formPass);
$auth_username_en = $auth_formUser;
if (authDo($auth_username_en, $auth_password_en)) {
setcookie ('fum_user', $auth_username_en,time()+3600);
setcookie ('fum_pass', $auth_password_en,time()+3600);
$auth_msg = "<b>Authentication successful!</b> The cookies have been set.<br><br>".
$auth_msg . "Your password (MD5 encrypted) is: $auth_password_en";
} else {
$auth_msg = "<b>Authentication error!</b>";
}
}
if (($_GET[act]=="dl")&&$_GET[file])
{
if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && isset($fum_user) && !isset($logout))) {
if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && authDo($fum_user, $fum_pass))) {
$value_de=base64_decode($_GET[file]);
$dl_full=$dir_store."/".$value_de;
$dl_name=$value_de;
if (!file_exists($dl_full))
{
echo"ERROR: Cannot download file, it does not exist.<br>»<a href='index.php?ir=1'>back</a>";
exit();
}
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$dl_name");
header("Content-Length: ".filesize($dl_full));
header("Accept-Ranges: bytes");
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-transfer-encoding: binary");
@readfile($dl_full);
exit();
}
}
}
function getlast($toget)
{
$pos=strrpos($toget,".");
$lastext=substr($toget,$pos+1);
return $lastext;
}
function replace($o)
{
$o=str_replace("/","",$o);
$o=str_replace("\\","",$o);
$o=str_replace(":","",$o);
$o=str_replace("*","",$o);
$o=str_replace("?","",$o);
$o=str_replace("<","",$o);
$o=str_replace(">","",$o);
$o=str_replace("\"","",$o);
$o=str_replace("|","",$o);
return $o;
}
?>
<!-- <?=$fum_info_full?> -->