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. $db_file = _FILE_DB_RESRES_INDEX_;
  22. PDO_Connect("$db_file");
  23. switch ($op) {
  24. case "all":
  25. //查热门
  26. $query = "select * from 'index' where 1 ORDER BY hit DESC limit 0,10";
  27. $Fetch = PDO_FetchAll($query);
  28. $iFetch = count($Fetch);
  29. if ($iFetch > 0) {
  30. echo "<ul class='search_list'>";
  31. echo "<li class='title'>排行</li>";
  32. for ($i = 0; $i < $iFetch; $i++) {
  33. $book = $Fetch[$i]["book"];
  34. if (substr($book, 0, 1) == 'p') {
  35. $book = substr($book, 1);
  36. }
  37. $open_link = "onclick='index_render_res_list(" . $Fetch[$i]["book"] . "," . $Fetch[$i]["album"] . "," . $Fetch[$i]["paragraph"] . ")'";
  38. echo "<li>";
  39. echo "<div class='search_item' $open_link>" . $Fetch[$i]["title"] . "<br/>" . get_book_info_html($book) . "</div>";
  40. echo "<div>点击:" . $Fetch[$i]["hit"] . "</div>";
  41. echo "</li>";
  42. }
  43. echo "</ul>";
  44. }
  45. //查最新
  46. $query = "select * from 'index' where 1 ORDER BY create_time DESC limit 0,10";
  47. $Fetch = PDO_FetchAll($query);
  48. $iFetch = count($Fetch);
  49. if ($iFetch > 0) {
  50. echo "<ul class='search_list'>";
  51. echo "<li class='title'>最新</li>";
  52. for ($i = 0; $i < $iFetch; $i++) {
  53. $book = $Fetch[$i]["book"];
  54. if (substr($book, 0, 1) == 'p') {
  55. $book = substr($book, 1);
  56. }
  57. $open_link = "onclick='index_render_res_list(" . $Fetch[$i]["book"] . "," . $Fetch[$i]["album"] . "," . $Fetch[$i]["paragraph"] . ")'";
  58. $book_info = "《" . $book_name[$book][0] . "》<span>" . $book_name[$book][1] . "</span>";
  59. echo "<li>";
  60. echo "<div class='search_item' $open_link><span class='media_type'>" . $media_type[$Fetch[$i]["type"]] . "</span>" . $Fetch[$i]["title"] . "<br/>$book_info</div>";
  61. echo "<div>" . date("Y-m-d", $Fetch[$i]["create_time"]) . "</div>";
  62. echo "</li>";
  63. }
  64. echo "</ul>";
  65. }
  66. break;
  67. case "new":
  68. $query = "select * from 'index' where 1 ORDER BY create_time DESC limit 0,100";
  69. $Fetch = PDO_FetchAll($query);
  70. $iFetch = count($Fetch);
  71. if ($iFetch > 0) {
  72. echo "<ul class='search_list'>";
  73. for ($i = 0; $i < $iFetch; $i++) {
  74. $book = $Fetch[$i]["book"];
  75. if (substr($book, 0, 1) == 'p') {
  76. $book = substr($book, 1);
  77. }
  78. $open_link = "onclick='index_render_res_list(" . $Fetch[$i]["book"] . "," . $Fetch[$i]["album"] . "," . $Fetch[$i]["paragraph"] . ")'";
  79. $book_info = "《" . $book_name[$book][0] . "》<span>" . $book_name[$book][1] . "</span>";
  80. echo "<li>";
  81. echo "<div class='search_item' $open_link><span class='media_type'>" . $media_type[$Fetch[$i]["type"]] . "</span>" . $Fetch[$i]["title"] . "<br/>$book_info</div>";
  82. echo "<div>" . date("Y-m-d", $Fetch[$i]["create_time"]) . "</div>";
  83. echo "</li>";
  84. }
  85. echo "</ul>";
  86. }
  87. break;
  88. case "hot":
  89. break;
  90. }