Esempio n. 1
0
require_once 'ftpCon.php';
include "arquivosSuportados.php";
@session_start();
$nameFile = $_POST["file"];
if ($_POST['path'] == '.') {
    $_POST['path'] = '';
}
$fileLocation = $_POST["path"];
$fp = fopen('tmptouch', 'w+');
fwrite($fp, '');
$f = new ftpCon();
$f->conect(base64_decode($_SESSION[MD5('server')]));
$f->login(base64_decode($_SESSION[MD5('user')]), base64_decode($_SESSION[MD5('password')]));
$items = $f->readDir($fileLocation);
if (!in_array($nameFile, $items)) {
    if ($f->upload($fileLocation . DIRECTORY_SEPARATOR . $nameFile, 'tmptouch')) {
        ?>
    <script>
        $(document).ready(function () {
            $('.table').DataTable().destroy();

            $('.table-arquivos').prepend('<tr>' +
                '<td><input type="checkbox" class="homeCheck"></td>' +
                '<td class="nomeArquivo"><i class="glyphicon glyphicon-file"></i> <?php 
        echo $nameFile;
        ?>
</a></td>' +
                '<td class="tamanhoArquivo">0 B</td>' +
                '<td class="dataArquivo"><?php 
        echo date('d/M H:i');
        ?>
Esempio n. 2
0
<?php

require_once 'ftpCon.php';
@session_start();
$content = $_POST['content'];
$file = $_POST[MD5('fileLocation')];
$fp = fopen('tmpedit', 'w+');
fwrite($fp, $content);
$f = new ftpCon();
$f->conect(base64_decode($_SESSION[MD5('server')]));
$f->login(base64_decode($_SESSION[MD5('user')]), base64_decode($_SESSION[MD5('password')]));
if ($f->upload(base64_decode($file), 'tmpedit')) {
    ?>
    <div class="alert alert-success alert-edit-res" style="display: none">Arquivo editado com sucesso.</div>
<?php 
} else {
    ?>
    <div class="alert alert-danger alert-edit-res" style="display: none">Erro ao editar o arquivo.</div>

    <?php 
}
fclose($fp);
$fp = fopen('tmpedit', 'w+');
fwrite($fp, '');
fclose($fp);
$f->logout();
?>
<script>
    $(document).ready(function(){
        $('.alert-edit-res').slideDown();
        setTimeout(function(){
Esempio n. 3
0
<?php 
@session_start();
require_once 'ftpCon.php';
$f = new ftpCon();
$f->conect(base64_decode($_SESSION[MD5('server')]));
$f->login(base64_decode($_SESSION[MD5('user')]), base64_decode($_SESSION[MD5('password')]));
$c = 0;
if ($_POST['c5da39db1424d6b7ee693d9b23ee5a39'] == '.') {
    $_POST['c5da39db1424d6b7ee693d9b23ee5a39'] = '';
}
$local = $_POST['c5da39db1424d6b7ee693d9b23ee5a39'];
for ($i = 0; $i < count($_FILES['file']['name']); $i++) {
    if (!empty($_FILES['file']['name'][$i])) {
        $c++;
        if ($_FILES['file']['size'][$i] <= 4194304) {
            if ($f->upload($local . $_FILES['file']['name'][$i], $_FILES['file']['tmp_name'][$i])) {
            } else {
                $_SESSION['erroUpload'][] = 'Não foi possível enviar o arquivo ' . $_FILES['file']['name'][$i];
            }
        } else {
            $_SESSION['erroUpload'][] = 'Não foi possível enviar o arquivo ' . $_FILES['file']['name'][$i] . ", pois o mesmo excede o tamanho limite de upload";
        }
    }
}
if ($c > 0) {
    if (count($_SESSION['erroUpload']) == 0) {
        $_SESSION['erroUpload'] = 'OK';
    }
} else {
    $_SESSION['erroUpload'] = 'N';
}