2
0

get_best.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. include "../public/config.php";
  3. include "../public/_pdo.php";
  4. if (isset($_COOKIE["language"])) {
  5. $lang = $_COOKIE["language"];
  6. } else {
  7. $lang = "en";
  8. }
  9. if (file_exists("language/db_{$lang}.php")) {
  10. include_once "language/db_{$lang}.php";
  11. } else {
  12. include_once "language/db_default.php";
  13. }
  14. include "./function.php";
  15. if (isset($_GET["op"])) {
  16. $op = $_GET["op"];
  17. } else {
  18. echo "no op";
  19. exit;
  20. }
  21. PDO_Connect(_FILE_DB_RESRES_INDEX_);
  22. switch ($op) {
  23. case "all":
  24. //查热门
  25. $query = "select * from 'index' where 1 ORDER BY hit DESC limit 0,10";
  26. $Fetch = PDO_FetchAll($query);
  27. $iFetch = count($Fetch);
  28. if ($iFetch > 0) {
  29. echo "<ul class='search_list'>";
  30. echo "<li class='title'>排行</li>";
  31. for ($i = 0; $i < $iFetch; $i++) {
  32. $book = $Fetch[$i]["book"];
  33. if (substr($book, 0, 1) == 'p') {
  34. $book = substr($book, 1);
  35. }
  36. $open_link = "onclick='index_render_res_list(" . $Fetch[$i]["book"] . "," . $Fetch[$i]["album"] . "," . $Fetch[$i]["paragraph"] . ")'";
  37. echo "<li>";
  38. echo "<div class='search_item' $open_link>" . $Fetch[$i]["title"] . "<br/>" . get_book_info_html($book) . "</div>";
  39. echo "<div>点击:" . $Fetch[$i]["hit"] . "</div>";
  40. echo "</li>";
  41. }
  42. echo "</ul>";
  43. }
  44. //查最新
  45. $query = "select * from 'index' where 1 ORDER BY create_time DESC limit 0,10";
  46. $Fetch = PDO_FetchAll($query);
  47. $iFetch = count($Fetch);
  48. if ($iFetch > 0) {
  49. echo "<ul class='search_list'>";
  50. echo "<li class='title'>最新</li>";
  51. for ($i = 0; $i < $iFetch; $i++) {
  52. $book = $Fetch[$i]["book"];
  53. if (substr($book, 0, 1) == 'p') {
  54. $book = substr($book, 1);
  55. }
  56. $open_link = "onclick='index_render_res_list(" . $Fetch[$i]["book"] . "," . $Fetch[$i]["album"] . "," . $Fetch[$i]["paragraph"] . ")'";
  57. $book_info = "《" . $book_name[$book][0] . "》<span>" . $book_name[$book][1] . "</span>";
  58. echo "<li>";
  59. echo "<div class='search_item' $open_link><span class='media_type'>" . $media_type[$Fetch[$i]["type"]] . "</span>" . $Fetch[$i]["title"] . "<br/>$book_info</div>";
  60. echo "<div>" . date("Y-m-d", $Fetch[$i]["create_time"]) . "</div>";
  61. echo "</li>";
  62. }
  63. echo "</ul>";
  64. }
  65. break;
  66. case "new":
  67. $query = "select * from 'index' where 1 ORDER BY create_time DESC limit 0,100";
  68. $Fetch = PDO_FetchAll($query);
  69. $iFetch = count($Fetch);
  70. if ($iFetch > 0) {
  71. echo "<ul class='search_list'>";
  72. for ($i = 0; $i < $iFetch; $i++) {
  73. $book = $Fetch[$i]["book"];
  74. if (substr($book, 0, 1) == 'p') {
  75. $book = substr($book, 1);
  76. }
  77. $open_link = "onclick='index_render_res_list(" . $Fetch[$i]["book"] . "," . $Fetch[$i]["album"] . "," . $Fetch[$i]["paragraph"] . ")'";
  78. $book_info = "《" . $book_name[$book][0] . "》<span>" . $book_name[$book][1] . "</span>";
  79. echo "<li>";
  80. echo "<div class='search_item' $open_link><span class='media_type'>" . $media_type[$Fetch[$i]["type"]] . "</span>" . $Fetch[$i]["title"] . "<br/>$book_info</div>";
  81. echo "<div>" . date("Y-m-d", $Fetch[$i]["create_time"]) . "</div>";
  82. echo "</li>";
  83. }
  84. echo "</ul>";
  85. }
  86. break;
  87. case "hot":
  88. break;
  89. }