<?php

include_once 'config.php';
include_once 'namecheck.php';
$folder = "";
/*
File Upload
*/
if (isset($_POST['upload'])) {
    if (is_uploaded_file($_FILES['UploadFile']['tmp_name'])) {
        if (!filetypeCheck($_FILES['UploadFile']['name']) || !isValid($_FILES['UploadFile']['name'], true)) {
            if ($_GET['dir']) {
                header('Location: user.php?dir=' . $_GET['dir'] . '&upload=fail2');
            } else {
                header('Location: user.php?upload=fail2');
            }
        } else {
            if ($_POST['uploaddir']) {
                if (uploadCheck($uploaddir . $_POST['uploaddir'])) {
                    move_uploaded_file($_FILES['UploadFile']['tmp_name'], $uploaddir . $_POST['uploaddir'] . '/' . $_FILES['UploadFile']['name']);
                    if (UPLOAD_ERR_OK) {
                        header('Location: user.php?dir=' . $_POST['uploaddir'] . '&upload=fail');
                    } else {
                        //	header( 'Location: user.php?dir='.$_POST['uploaddir'].'&upload=success' );
                    }
                } else {
                    header('Location: user.php?upload=fail');
                }
            } else {
                move_uploaded_file($_FILES['UploadFile']['tmp_name'], $uploaddir . "/" . $_FILES['UploadFile']['name']);
                if (UPLOAD_ERR_OK) {
Beispiel #2
0
<?php

include_once 'namecheck.php';
include_once 'config.php';
if ($_POST['newname']) {
    if (isValid($_POST['newname'], true) && filetypeCheck($_POST['newname'])) {
        $loc = "uploaded_files/" . $_POST['basedir'];
        if (is_dir($uploaddir . $_POST['basedir'] . "/" . $_POST['oldname'])) {
            $newname = str_replace(" ", "_", $_POST['newname']);
        } else {
            $extension = pathinfo($_POST['oldname'], PATHINFO_EXTENSION);
            $newname = $_POST['newname'] . "." . $extension;
        }
        $renameresult = rename($loc . "/" . $_POST['oldname'], $loc . "/" . $newname);
        if ($renameresult) {
            header("Location: user.php?dir=" . $_POST['returndir'] . "&renameres=success");
        } else {
            header("Location: user.php?dir=" . $_POST['returndir'] . "&renameres=fail");
        }
    } else {
        header("Location: user.php?dir=" . $_POST['returndir'] . "&renameres=notallowed");
    }
}