Example #1
0
    if (!file_exists($_FILES['photo']['tmp_name']) || !is_uploaded_file($_FILES['photo']['tmp_name'])) {
        update_working($fName, $mName, $lName, $course, $yr, $lab, $time, $days, $id);
        update_account($pass, $id);
        $message = "<div class = 'alert alert-success' style = 'width: 350px;'>{$fName} {$mName} {$lName} record has been successfully updated.</div>";
        echo "<script>";
        //go back to viewMed page after 3 seconds.
        echo "setTimeout(function(){ document.location = '?p=viewWorking'; }, 2000);";
        echo "</script>";
    } else {
        if ($photo && !$photo['error']) {
            $name = $photo['name'];
            $type = $photo['type'];
            $path = $photo['tmp_name'];
            $bytes = file_get_contents($path);
            $user = $_SESSION['user'];
            update_photo($name, $type, $bytes, $user, $id);
            update_working($fName, $mName, $lName, $course, $yr, $lab, $time, $days, $id);
            update_account($pass, $id);
            $message = "<div class = 'alert alert-success' style = 'width: 350px;'>{$fName} {$mName} {$lName} record has been successfully updated.</div>";
            echo "<script>";
            //go back to viewMed page after 3 seconds.
            echo "setTimeout(function(){ document.location = '?p=viewWorking'; }, 2000);";
            echo "</script>";
        } else {
            $message = "<div class = 'alert alert-warning' style = 'width: 350px;'>Invalid File.</div>";
        }
    }
} else {
    //if not submitted we retrieve the data from the database
    $workingFind = find_working($id);
    if ($workingFind) {
Example #2
0
<?php

if (!isset($_REQUEST['pid'])) {
    fail('更新错误,没有设置 pid!');
}
// 更新标题
if (isset($_REQUEST['title'])) {
    $title = array(array('title', $_REQUEST['title']));
    update_photo($_REQUEST['pid'], $title);
}
// 更新描述
if (isset($_REQUEST['desc'])) {
    $desc = array(array('description', $_REQUEST['desc']));
    update_photo($_REQUEST['pid'], $desc);
}
// 更新状态
if (isset($_REQUEST['status'])) {
    $status = array(array('status', $_REQUEST['status']));
    update_photo($_REQUEST['pid'], $status);
}