get.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. require_once "../public/_pdo.php";
  3. require_once "../path.php";
  4. $result["error"]="";
  5. $result["data"]=array();
  6. if(isset($_GET["book"])){
  7. $book = $_GET["book"];
  8. }
  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. }
  17. else{
  18. $result["error"]="no param";
  19. echo json_encode($result,JSON_UNESCAPED_UNICODE);
  20. exit;
  21. }
  22. PDO_Connect("sqlite:"._FILE_DB_PAGE_INDEX_);
  23. $query = "SELECT * from m where book=? and para=?";
  24. $Fetch = PDO_FetchAll($query,array($book,$para));
  25. foreach ($Fetch as $key => $value){
  26. $query = "SELECT * from book_match where book_vri=? and vol=?";
  27. $Fetch_nsy_book = PDO_FetchRow($query,array($value["book"],$value["page1"]));
  28. if($Fetch_nsy_book){
  29. $prefix = $Fetch_nsy_book["table"];
  30. $query = "SELECT * from {$prefix}_pagematch where bookid=? and bookpagenumber=?";
  31. $Fetch_nsy_index = PDO_FetchRow($query,array($Fetch_nsy_book["bookid"],$value["page2"]));
  32. $Fetch_nsy_index["dir"]=$prefix;
  33. $result["data"][] = $Fetch_nsy_index;
  34. }
  35. else{
  36. $result["error"]= "error: in table book_match";
  37. }
  38. }
  39. echo json_encode($result,JSON_UNESCAPED_UNICODE);
  40. ?>