Jump to content

Amek

Members
  • Posts

    3
  • Joined

  • Last visited

Recent Profile Visitors

1429 profile views

Amek's Achievements

Newbie

Newbie (1/14)

  • First Post Rare
  • Week One Done Rare
  • One Month Later Rare
  • One Year In Rare

Recent Badges

0

Reputation

  1. Ai putea inlocui $dir_handle = @opendir($path) or die("Unable to open folder"); while (false !== ($file = readdir($dir_handle))) { if($file == "index.php") continue; if($file == ".") continue; if($file == "..") continue; echo "<input type='CHECKBOX' name='file[]' value='$file'>"; echo "<a href='upload/$file' target='_blank'>"; echo "<img src='upload/$file' alt='$file' style='height: 100px; width: 100px;'/></a>&nbsp;&nbsp;"; } closedir($dir_handle); Cu function sortByTime($a, $b) { $datePuzzleA = explode("-", explode("_", $a)[0]); $dateA = strtotime(implode("-", array_slice($datePuzzleA, 0, 3))." ".implode(":", array_slice($datePuzzleA, 3, 3))); $datePuzzleB = explode("-", explode("_", $b)[0]); $dateB = strtotime(implode("-", array_slice($datePuzzleB, 0, 3))." ".implode(":", array_slice($datePuzzleB, 3, 3))); if ($a === $b) { return 0; } return $b > $a ? -1 : 1; } $files = array_diff(scandir($path), array('.', '..', 'index.php')); usort($files, "sortByTime"); foreach($files as $file) { echo "<input type='CHECKBOX' name='file[]' value='$file'>"; echo "<a href='upload/$file' target='_blank'>"; echo "<img src='upload/$file' alt='$file' style='height: 100px; width: 100px;'/></a>&nbsp;&nbsp;"; } Desi nu cred ca e cea mai eleganta solutie.
  2. Ia un leu si du-l de aici.
×
×
  • Create New...