pc_get_book_xml.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. $currBook = $_GET["book"];
  3. $currParagraph = $_GET["paragraph"];
  4. $currVer = $_GET["ver"];
  5. include "./config.php";
  6. include "./_pdo.php";
  7. $countInsert = 0;
  8. $wordlist = array();
  9. $tempFile = "temp.txt";
  10. $guid = com_create_guid();
  11. $outXml = "<pkg>";
  12. $outXml .= "<block>";
  13. $outXml .= "<info><id>$guid</id><book>$currBook</book><paragraph>$currParagraph</paragraph><ver>$currVer</ver><type>wbw</type><author>pcds</author><language>com</language></info>";
  14. $outXml .= "<data>";
  15. echo $outXml;
  16. $db_file = "../appdata/palicanon/templet/" . $currBook . "_tpl.db3";
  17. //open database
  18. PDO_Connect("$db_file");
  19. $query = "SELECT * FROM \"main\" WHERE \"book\" = " . $PDO->quote($currBook) . " AND \"paragraph\" = " . $PDO->quote($currParagraph) . " ORDER BY vri ";
  20. $Fetch = PDO_FetchAll($query);
  21. $iFetch = count($Fetch);
  22. if ($iFetch > 0) {
  23. for ($i = 0; $i < $iFetch; $i++) {
  24. $outXml = "<word>";
  25. $outXml = $outXml . "<id>" . $Fetch[$i]["wid"] . "</id>";
  26. $outXml = $outXml . "<pali>" . $Fetch[$i]["word"] . "</pali>";
  27. $outXml = $outXml . "<real>" . $Fetch[$i]["real"] . "</real>";
  28. $outXml = $outXml . "<type>" . $Fetch[$i]["type"] . "</type>";
  29. $outXml = $outXml . "<gramma>" . $Fetch[$i]["gramma"] . "</gramma>";
  30. $outXml = $outXml . "<case>" . $Fetch[$i]["type"] . "#" . $Fetch[$i]["gramma"] . "</case>";
  31. $outXml = $outXml . "<mean>" . $Fetch[$i]["mean"] . "</mean>";
  32. $outXml = $outXml . "<note>" . $Fetch[$i]["note"] . "</note>";
  33. $outXml = $outXml . "<org>" . $Fetch[$i]["part"] . "</org>";
  34. $outXml = $outXml . "<om>" . $Fetch[$i]["partmean"] . "</om>";
  35. $outXml = $outXml . "<bmc>" . $Fetch[$i]["bmc"] . "</bmc>";
  36. $outXml = $outXml . "<bmt>" . $Fetch[$i]["bmt"] . "</bmt>";
  37. $outXml = $outXml . "<un>" . $Fetch[$i]["un"] . "</un>";
  38. $outXml = $outXml . "<style>" . $Fetch[$i]["style"] . "</style>";
  39. $outXml = $outXml . "</word>";
  40. echo $outXml;
  41. }
  42. }
  43. /*直接查询结束*/
  44. $outXml = "</data></block></pkg>";
  45. echo $outXml;