예제 #1
0
파일: upload.php 프로젝트: kamy333/kamy
<?php

require_once '../includes/initialize.php';
confirm_logged_in();
if (!is_admin() && !is_kamy()) {
    redirect_to('manage_program.php');
}
?>


<?php 
// In an application, this could be moved to a config file
$upload_errors = array(UPLOAD_ERR_OK => "No errors.", UPLOAD_ERR_INI_SIZE => "Larger than upload_max_filesize.", UPLOAD_ERR_FORM_SIZE => "Larger than form MAX_FILE_SIZE.", UPLOAD_ERR_PARTIAL => "Partial upload.", UPLOAD_ERR_NO_FILE => "No file.", UPLOAD_ERR_NO_TMP_DIR => "No temporary directory.", UPLOAD_ERR_CANT_WRITE => "Can't write to disk.", UPLOAD_ERR_EXTENSION => "File upload stopped by extension.");
if (isset($_POST['submit'])) {
    // process the form data
    $tmp_file = $_FILES['file_upload']['tmp_name'];
    $target_file = basename($_FILES['file_upload']['name']);
    $upload_dir = SITE_ROOT . DS . "uploads";
    $path_filenme = $upload_dir . "/" . $target_file;
    chmod($upload_dir, 0777);
    chmod($path_filenme, 0777);
    chmod($tmp_file, 0777);
    // You will probably want to first use file_exists() to make sure
    // there isn't already a file by the same name.
    // move_uploaded_file will return false if $tmp_file is not a valid upload file
    // or if it cannot be moved for any other reason
    if (move_uploaded_file($tmp_file, $upload_dir . "/" . $target_file)) {
        log_action('Upload file success', "{$_SESSION['username']} uploaded file {$path_filenme} " . $temp_file . " - " . $target_file);
        $message = "File uploaded successfully.";
        chmod($path_filenme, 0777);
    } else {
예제 #2
0
<?php

/**
 * Created by PhpStorm.
 * User: Kamran
 * Date: 5/5/2015
 * Time: 11:07 PM
 */
?>
<!--   TODO begin testing -->

<?php 
if (is_admin() && is_kamy()) {
    ?>
<div class="row">
<pre>
<br>
<?php 
    if ($_GET) {
        echo 'Contents of the $_GET array: <br>';
        print_r($_GET);
    } elseif ($_POST) {
        echo 'Contents of the $_POST array: <br>';
        print_r($_POST);
    }
    echo $_SERVER['PHP_SELF'] . "<br>";
    echo $_SERVER['COMPUTERNAME'];
    ?>
</pre>
</div>
<!--  TODO end testing       -->