my_article_put.php 857 B

12345678910111213141516171819
  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. $respond=array("status"=>0,"message"=>"");
  7. PDO_Connect("sqlite:"._FILE_DB_USER_ARTICLE_);
  8. $query="INSERT INTO article ( id, title , subtitle , summary , content , tag , owner, setting , status , create_time , modify_time , receive_time ) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ) ";
  9. $sth = $PDO->prepare($query);
  10. $sth->execute(array(UUID::v4() , $_POST["title"] , "" ,"", "" , "" , $_COOKIE["userid"] , "{}" , 1 , mTime() , mTime() , mTime() ));
  11. $respond=array("status"=>0,"message"=>"");
  12. if (!$sth || ($sth && $sth->errorCode() != 0)) {
  13. $error = PDO_ErrorInfo();
  14. $respond['status']=1;
  15. $respond['message']=$error[2];
  16. }
  17. echo json_encode($respond, JSON_UNESCAPED_UNICODE);
  18. ?>