my_article_put.php 984 B

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