list_article_in_collect.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. //查询term字典
  3. require_once "../config.php";
  4. require_once "../public/_pdo.php";
  5. require_once '../public/function.php';
  6. require_once '../ucenter/function.php';
  7. $output = array();
  8. if(isset($_GET["id"])){
  9. PDO_Connect(""._FILE_DB_USER_ARTICLE_);
  10. $article_id=$_GET["id"];
  11. $query = "SELECT collect_id as id from article_list where article_id = ? ";
  12. $exist = PDO_FetchAll($query,array($article_id));
  13. $exist_id = array();
  14. for ($i=0; $i < count($exist) ; $i++) {
  15. # query collect title
  16. $query = "SELECT title from collect where id = ? ";
  17. $exist[$i]["title"] = PDO_FetchOne($query,array($exist[$i]["id"]));
  18. $exist_id[$exist[$i]["id"]] = 1;
  19. }
  20. $output["exist"] = $exist;
  21. $query = "SELECT id,title from collect where owner = ? AND status <> 0 order by modify_time DESC limit 0,50";
  22. $others = PDO_FetchAll($query,array($_COOKIE["userid"]));
  23. foreach ($others as $key => $value) {
  24. # remove exist record
  25. if(!isset($exist_id[$value["id"]])){
  26. $output["others"][] = $value;
  27. }
  28. }
  29. $output["article_id"]=$article_id;
  30. echo json_encode($output, JSON_UNESCAPED_UNICODE);
  31. }
  32. else{
  33. echo json_encode(array(), JSON_UNESCAPED_UNICODE);
  34. }
  35. ?>