Файл: upload.php
Строк: 74
<?php
error_reporting(0);
$k=trim($_GET['k']); include("key.php");
$d=rawurldecode(trim($_GET['d'])); $n=rawurldecode(trim($_GET['n']));
if ($d==NULL) {$d="";} else {if ($d=="/") {$d="";}}
if ($n==NULL) {$n=preg_replace("~.*/([^/]*)~m","\1",$d);
$d=preg_replace("~(.*)/[^/]*~m","\1",$d);}
if ($n==NULL) {$n=preg_replace("~.*/([^/]*)~m","\1",$d); $d=preg_replace("~(.*)/[^/]*~m","\1",$d);}
$rd=rawurlencode($d); $rn=rawurlencode($n);
$d=str_replace(".|htaccess",".htaccess",$d);
$n=str_replace(".|htaccess",".htaccess",$n);
$cnt=count($_FILES['nm']['name']);
include "includes/header.php";
echo '
<div class="box_2">
Путь: <b><a href="ftp.php?k='.$k.'&d='.$rd.'&n='.$rn.'">'.$d.'/'.$n.'</a></b><br/>
</div>
<div class="box_1">';
if ($cnt<>NULL) {$st="";
if (($ftp=@ftp_connect($sr))&&(@ftp_login($ftp,$lg,$ps))) {
@ftp_pasv($ftp,true);
for ($i=0;$i<$cnt;$i++) {
if (($_FILES['nm']['name'][$i]<>NULL)&&($_FILES['nm']['size'][$i]<=7340032)&&($_FILES['nm']['size'][$i]>0)) {
$name=preg_replace("~.*/([^/]*)~m","\1",$_FILES['nm']['name'][$i]);
if (ftp_put($ftp,"$d/$n/$name",$_FILES['nm']['tmp_name'][$i],FTP_BINARY)) {
$sz=$_FILES['nm']['size'][$i];
$st.="Файл "".htmlspecialchars($name)."" размером $sz байт успешно закачан.<br>";
} else {$st.="Файл "".htmlspecialchars($name)."" не закачан.<br>";}
}
}
@ftp_close($ftp);
if ($st==NULL) {$st="Файлы не закачаны.<br>";}
echo("$st- - -<br>");
} else {
echo '<div class="box_1">
Нет соединения с сервером</div>
<div class="title_page"><a href="index.php">Главная</a></div>';
include "includes/footer.php";
exit;
}
}
echo '
<form action="upload.php?k='.$k.'&d='.$rd.'&n='.$rn.'" enctype="multipart/form-data" method="post">
<b>Файлы</b>:<br>
<input name="nm[]" type="file"><br>
<input name="nm[]" type="file"><br>
<input name="nm[]" type="file"><br>
<input name="nm[]" type="file"><br>
<input name="nm[]" type="file"><br>
<input name="nm[]" type="file"><br>
<input name="nm[]" type="file"><br>
<input type="submit" value="Загрузить"><br/>
</form>
</div>';
include "includes/footer.php";
?>