getfilelist.php 1.5 KB

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