get_book_list.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. require_once "../public/_pdo.php";
  3. require_once "../config.php";
  4. require_once "../ucenter/active.php";
  5. $result["error"] = "";
  6. $result["data"] = array();
  7. if (isset($_GET["book"])) {
  8. $book = $_GET["book"];
  9. } else {
  10. $result["error"] = "no param";
  11. echo json_encode($result, JSON_UNESCAPED_UNICODE);
  12. exit;
  13. }
  14. if (isset($_GET["para"])) {
  15. $para = $_GET["para"];
  16. } else {
  17. $result["error"] = "no param";
  18. echo json_encode($result, JSON_UNESCAPED_UNICODE);
  19. exit;
  20. }
  21. if (isset($_GET["begin"])) {
  22. $begin = $_GET["begin"];
  23. } else {
  24. $begin = 0;
  25. }
  26. if (isset($_GET["end"])) {
  27. $end = $_GET["end"];
  28. } else {
  29. $end = 0;
  30. }
  31. add_edit_event(_NISSAYA_FIND_, "{$book}-{$para}-{$begin}-{$end}");
  32. PDO_Connect("" . _FILE_DB_PAGE_INDEX_);
  33. $query = "SELECT * from m where book=? and para=?";
  34. $Fetch = PDO_FetchRow($query, array($book, $para));
  35. $query = "SELECT * from book_match where book_vri=? and vol=?";
  36. $Fetch_nsy_book = PDO_FetchRow($query, array($Fetch["book"], $Fetch["page1"]));
  37. if ($Fetch_nsy_book) {
  38. $prefix = $Fetch_nsy_book["table"];
  39. $query = "select nsyid from {$prefix}_pagematch where bookid = ? and bookpagenumber = ? group by nsyid";
  40. $Fetch_nsy_book = PDO_FetchAll($query, array($Fetch_nsy_book["bookid"],$Fetch["page2"]));
  41. foreach ($Fetch_nsy_book as $key => $book) {
  42. # code...
  43. $query = "select nsyname from {$prefix}_pagematch where nsyid = ? ";
  44. $Fetch_nsy_book[$key]['name'] = PDO_FetchRow($query, array($book["nsyid"]))['nsyname'];
  45. $Fetch_nsy_book[$key]['type'] = $prefix;
  46. }
  47. $result["data"] = json_encode($Fetch_nsy_book, JSON_UNESCAPED_UNICODE);
  48. } else {
  49. $result["error"] = "error: in table book_match";
  50. }
  51. echo json_encode($result, JSON_UNESCAPED_UNICODE);