getfilelist.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. include "./config.php";
  3. include "./_pdo.php";
  4. if (isset($_GET["uid"])) {
  5. $uid = $_GET["uid"];
  6. } else {
  7. echo "no user id";
  8. exit;
  9. }
  10. if (isset($_GET["orderby"])) {
  11. $order_by = $_GET["orderby"];
  12. } else {
  13. $order_by = "update_time";
  14. }
  15. if (isset($_GET["order"])) {
  16. $order = $_GET["order"];
  17. } else {
  18. $order = "desc";
  19. }
  20. //获取服务器端文件列表
  21. $db_file = _FILE_DB_RESRES_INDEX_;
  22. PDO_Connect("$db_file");
  23. /*
  24. $files = scandir($dir);
  25. $arrlength=count($files);
  26. for($x=0;$x<$arrlength;$x++) {
  27. if(is_file($dir.$files[$x])){
  28. echo $files[$x].',';
  29. }
  30. }
  31. */
  32. switch ($order_by) {
  33. case "accese_time":
  34. case "create_time":
  35. case "modify_time":
  36. $time_show = $order_by;
  37. break;
  38. default:
  39. $time_show = "accese_time";
  40. break;
  41. }
  42. $query = "select * from 'index' where share='$uid' order by $order_by $order";
  43. //echo $query."<br>";
  44. $Fetch = PDO_FetchAll($query);
  45. $iFetch = count($Fetch);
  46. if ($iFetch > 0) {
  47. for ($i = 0; $i < $iFetch; $i++) {
  48. echo "<div class='file_list_shell'>";
  49. echo "<table style='width:100%;'><tr>";
  50. $filename = $Fetch[$i]["file_name"];
  51. $title = $Fetch[$i]["title"];
  52. $dir = "";
  53. $link = "<a href='editor.php?op=open&fileid=" . $Fetch[$i]["id"] . "&filename=$dir$filename" . "&language=sc' target='_blank'>";
  54. echo "<td width='70%'>$link$title</a></td>";
  55. echo "<td width='15%'>点击:" . $Fetch[$i]["hit"] . "</td>";
  56. echo "<td width='15%' style='text-align: right;'>" . date("Y-m-d h:i:sa", $Fetch[$i]["update_time"]) . "</td>";
  57. echo "</tr></table>";
  58. echo "</div>";
  59. }
  60. }