Файл: ftp/upload.php
Строк: 78
<?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);
require_once '../api_core/apicms_system.php';
require_once '../api_core/head.php';
$d=str_replace(".|htaccess",".htaccess",$d);
$n=str_replace(".|htaccess",".htaccess",$n);
require_once 'moduls/per.php';
$cnt=count($_FILES['nm']['name']);
echo'<div class="headmenu" style="padding: 8px; color:#fff;" >
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<td><img src="icons/cldir.png" width="16" height="16" alt=">"/>
<a style="color:#fff;" href="ftp.php?k='.$k.'&d='.$rd.'&n='.$rn.'">'.$d.'/'.$n.'</a>
</td>
<td align = "right">
<a class="headbut" href = "/ftp/">На главную</a>
<a class="headbut" href = "javascript:history.back(1)">Назад</a></td>
</div></div></table></div>';
echo '
<div class="subhead">';
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="subhead">
Нет соединения с сервером</div>
<div class="title_page"><a href="index.php">Главная</a></div>';
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>';
apicms_foot();
?>