Exemplo n.º 1
0
     if ($_FILES['resource']['error'] != 0) {
         $db->close();
         $result->outputErrResult('006');
     }
     //检查资源格式
     $file_type = $_FILES['resource']['type'];
     $check_file = check_upload_file($file_type);
     if ($check_file == FALSE) {
         $result->outputErrResult('201');
     }
     //删除原来文件
     //exec('rm -rf '.$resource_url);
     unlink($resource_url);
     $file_path = RESOURCE_RESOURCE_PATH . '/' . resource_folder($resource_id) . '/';
     $file_name = $user_id . '_' . $resource_id . '_resource.' . pathinfo($_FILES['resource']['name'], PATHINFO_EXTENSION);
     $resource_url = upload_resource_file($_FILES['resource']['tmp_name'], $file_path, $file_name);
     if (is_bool($resource_url) && FALSE == $resource_url) {
         $db->close();
         $result->outputErrResult('203');
     }
 }
 //更新数据库
 if (!$db->query("UPDATE resources SET resource_name='{$resource_name}',instruction='{$instruction}',resource_type='{$resource_type}',resource_tag='{$resource_tag}',update_time=NOW(),img_url='{$img_url}',resource_url='{$resource_url}' WHERE resource_id='{$resource_id}'")) {
     $db->close();
     $result->outputErrResult('004');
 }
 $db->close();
 $result->outputEnd();
 break;
 /*
  * 删除资源
Exemplo n.º 2
0
         $result->outputErrResult('006');
     }
     //获取图片信息,检查图片规格
     $img_type = $_FILES['img']['type'];
     $img_info = getimagesize($_FILES['img']['tmp_name']);
     $check_img = check_upload_image($img_type, $img_info);
     if (!is_bool($check_img)) {
         $db->close();
         $result->outputErrResult($check_img);
     }
     //删除原来文件
     //exec('rm -rf '.$img_url);
     unlink($img_url);
     $img_path = RESOURCE_NEWS_PATH . '/' . resource_folder($news_id) . '/';
     $img_name = $identify_number . '_' . $news_id . '_news_img.' . pathinfo($_FILES['img']['name'], PATHINFO_EXTENSION);
     $img_url = upload_resource_file($_FILES['img']['tmp_name'], $img_path, $img_name);
     if (is_bool($img_url) && FALSE == $img_url) {
         $db->close();
         $result->outputErrResult('203');
     }
 }
 //更新数据库
 if (!$db->query("UPDATE news SET news_title='{$title}',news_contents='{$contents}',news_author='{$author}',news_type='{$type}',news_from='{$from}',update_time=NOW(),identify_number='{$identify_number}' WHERE news_id='{$news_id}'")) {
     $db->close();
     $result->outputErrResult('004');
 }
 $db->close();
 $result->outputEnd();
 break;
 /*
  * 行业信息删除