2
0

getfilelist.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. PDO_Connect(_FILE_DB_RESRES_INDEX_);
  22. /*
  23. $files = scandir($dir);
  24. $arrlength=count($files);
  25. for($x=0;$x<$arrlength;$x++) {
  26. if(is_file($dir.$files[$x])){
  27. echo $files[$x].',';
  28. }
  29. }
  30. */
  31. switch ($order_by) {
  32. case "accese_time":
  33. case "create_time":
  34. case "modify_time":
  35. $time_show = $order_by;
  36. break;
  37. default:
  38. $time_show = "accese_time";
  39. break;
  40. }
  41. $query = "select * from 'index' where share='$uid' order by $order_by $order";
  42. //echo $query."<br>";
  43. $Fetch = PDO_FetchAll($query);
  44. $iFetch = count($Fetch);
  45. if ($iFetch > 0) {
  46. for ($i = 0; $i < $iFetch; $i++) {
  47. echo "<div class='file_list_shell'>";
  48. echo "<table style='width:100%;'><tr>";
  49. $filename = $Fetch[$i]["file_name"];
  50. $title = $Fetch[$i]["title"];
  51. $dir = "";
  52. $link = "<a href='editor.php?op=open&fileid=" . $Fetch[$i]["id"] . "&filename=$dir$filename" . "&language=sc' target='_blank'>";
  53. echo "<td width='70%'>$link$title</a></td>";
  54. echo "<td width='15%'>点击:" . $Fetch[$i]["hit"] . "</td>";
  55. echo "<td width='15%' style='text-align: right;'>" . date("Y-m-d h:i:sa", $Fetch[$i]["update_time"]) . "</td>";
  56. echo "</tr></table>";
  57. echo "</div>";
  58. }
  59. }