my_article_put.php 999 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /*
  3. 新建文章
  4. */
  5. require_once "../path.php";
  6. require_once "../public/_pdo.php";
  7. require_once '../public/function.php';
  8. require_once '../hostsetting/function.php';
  9. require_once "../ucenter/active.php";
  10. $respond=array("status"=>0,"message"=>"");
  11. PDO_Connect(_FILE_DB_USER_ARTICLE_);
  12. $query="INSERT INTO article ( id, title , subtitle , summary , content , tag , owner, setting , status , create_time , modify_time , receive_time ) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ) ";
  13. $sth = $PDO->prepare($query);
  14. $uuid = UUID::v4();
  15. //写入日志
  16. add_edit_event(_ARTICLE_NEW_,$uuid);
  17. #新建文章默认私有
  18. $sth->execute(array($uuid , $_POST["title"] , "" ,"", "" , "" , $_COOKIE["userid"] , "{}" , 10 , mTime() , mTime() , mTime() ));
  19. $respond=array("status"=>0,"message"=>"");
  20. if (!$sth || ($sth && $sth->errorCode() != 0)) {
  21. $error = PDO_ErrorInfo();
  22. $respond['status']=1;
  23. $respond['message']=$error[2];
  24. }
  25. echo json_encode($respond, JSON_UNESCAPED_UNICODE);
  26. ?>