Файл: hostbiter.ru/Modules/explode/createfile.php
Строк: 43
<?
require ($_SERVER['DOCUMENT_ROOT'].'/Core/core.php');
require ($_SERVER['DOCUMENT_ROOT'].'/Core/fmhead.php');
if(!empty($_GET['dir'])){
$dir = htmlspecialchars(trim($_GET['dir']));
}else{
$dir = encode('www');
}
function convmnem2str($str){
$str= str_replace('<','<',$str);
$str= str_replace('>','>',$str);
return $str;
}
if(isset($_GET['create'])){
$name = htmlspecialchars(trim($_POST['name']));
$text = htmlspecialchars(trim($_POST['text']));
$filename = 'tmp_'.rand(1,time());
$uploadfile = $_SERVER['DOCUMENT_ROOT'].'/tmp_files_isp/'.$filename;
file_put_contents($uploadfile,convmnem2str($text));
$connect_ftp = ftp_connect($config['FTPHost'],21,300);
$ftp = $db->prepare("SELECT * FROM `ftp_users` WHERE `user` = ? LIMIT 1");
$ftp->execute([$user['id']]);
$ftp = $ftp->fetch();
ftp_login($connect_ftp,$ftp['login'],$ftp['password']);
ftp_chdir($connect_ftp,'/'.decode($dir));
ftp_put($connect_ftp,$name,$uploadfile,FTP_ASCII);
ftp_close($connect_ftp);
unlink($uploadfile);
$_SESSION['message'] = 'Файл '.$name.' создан!';
header("Location: /explode?dir=".$dir."");
exit;
}
?>
<div id="border">Создание файла</div>
<form action="/explode/createfile.php?dir=<?=$dir?>&create" method="post">
Название файла: <br />
<input class="com" type="text" name="name" value="file.php" required/><br />
Содержимое: <br />
<textarea border="11" class="area" cols="40" rows="15" name="text" required><?php
?></textarea>
<input type="submit" value="Создать" name="create" />
</form>
<div>
<img src="/image/bf.gif" alt="" /> <a href="/explode.php?dir=<?=$dir?>">Назад</a><br />
<img src="/image/bf.gif" alt="" /> <a href="/explode.php?">Файловый менеджер</a><br />
<?
require ($_SERVER['DOCUMENT_ROOT'].'/Core/fmfoot.php');
?>