pc_get_res_list.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. $get_book=$_GET["book"];
  3. $get_par_list=$_GET["par_list"];
  4. $get_res_type=$_GET["res_type"];
  5. include "./config.php";
  6. include "./_pdo.php";
  7. $countInsert=0;
  8. $parList=str_getcsv($get_par_list,',');
  9. $parstring="";
  10. for($i=0;$i<count($parList);$i++)
  11. {
  12. $parstring.="'".$parList[$i]."'";
  13. if($i<count($parList)-1){
  14. $parstring.=",";
  15. }
  16. }
  17. $outXml = "<index>";
  18. echo $outXml;
  19. switch($get_res_type){
  20. case "translate":
  21. $tableName = "data";
  22. break;
  23. case "wbw":
  24. $tableName = "main";
  25. break;
  26. }
  27. $db_file = "../appdata/palicanon/".$get_res_type."/".$get_book."_".$get_res_type.".db3";
  28. //open database
  29. PDO_Connect("sqlite:$db_file");
  30. //for($iPar=0;$iPar<count($parList);$iPar++)
  31. {
  32. //$query = "select * FROM ".$tableName." where \"paragraph\"=".$PDO->quote($parList[$iPar]);
  33. $query = "select * FROM ".$tableName." where paragraph in (".$parstring.")";
  34. $Fetch = PDO_FetchAll($query);
  35. $iFetch=count($Fetch);
  36. if($iFetch>0){
  37. for($i=0;$i<$iFetch;$i++){
  38. $outXml = "<res>";
  39. $outXml = $outXml."<book>$get_book</book>";
  40. $outXml = $outXml."<par>".$Fetch[$i]["paragraph"]."</par>";
  41. $outXml = $outXml."<type>$get_res_type</type>";
  42. $outXml = $outXml."<language>".$Fetch[$i]["language"]."</language>";
  43. $outXml = $outXml."<author>".$Fetch[$i]["author"]."</author>";
  44. $outXml = $outXml."<editor>".$Fetch[$i]["editor"]."</editor>";
  45. $outXml = $outXml."<revision>".$Fetch[$i]["revision"]."</revision>";
  46. $outXml = $outXml."<edition>".$Fetch[$i]["edition"]."</edition>";
  47. $outXml = $outXml."<subver>".$Fetch[$i]["subver"]."</subver>";
  48. switch($get_res_type){
  49. case "translate":
  50. $outXml = $outXml."<text>".$Fetch[$i]["toc"]."</text>";
  51. break;
  52. }
  53. $outXml = $outXml."</res>";
  54. echo $outXml;
  55. }
  56. }
  57. }
  58. /*查询结束*/
  59. $outXml = "</index>";
  60. echo $outXml;
  61. ?>