my_collect_put.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. require_once "../config.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. if(!isset($_COOKIE["userid"])){
  9. #不登录不能新建
  10. $respond['status']=1;
  11. $respond['message']="no power create article";
  12. echo json_encode($respond, JSON_UNESCAPED_UNICODE);
  13. exit;
  14. }
  15. if(!isset($_POST["title"])){
  16. #无标题不能新建
  17. $respond['status']=1;
  18. $respond['message']="no title";
  19. echo json_encode($respond, JSON_UNESCAPED_UNICODE);
  20. exit;
  21. }
  22. $uuid = UUID::v4();
  23. add_edit_event(_COLLECTION_NEW_,$uuid);
  24. PDO_Connect(""._FILE_DB_USER_ARTICLE_);
  25. $query="INSERT INTO collect ( id, title , subtitle , summary , article_list , owner, lang , status , create_time , modify_time , receive_time ) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ) ";
  26. $sth = $PDO->prepare($query);
  27. $sth->execute(array($uuid , $_POST["title"] , "" ,"", "[]" , $_COOKIE["userid"] , "" , $_POST["status"] , mTime() , mTime() , mTime() ));
  28. $respond=array("status"=>0,"message"=>"");
  29. if (!$sth || ($sth && $sth->errorCode() != 0)) {
  30. $error = PDO_ErrorInfo();
  31. $respond['status']=1;
  32. $respond['message']=$error[2];
  33. }
  34. echo json_encode($respond, JSON_UNESCAPED_UNICODE);
  35. ?>