From 79670053c7247d3a49b607960efd284e93f057e5 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 2 Aug 2013 17:14:26 -0500 Subject: install.pl --- bPod/php/buckyFiles.php | 102 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 bPod/php/buckyFiles.php (limited to 'bPod/php/buckyFiles.php') diff --git a/bPod/php/buckyFiles.php b/bPod/php/buckyFiles.php new file mode 100644 index 0000000..00fdafd --- /dev/null +++ b/bPod/php/buckyFiles.php @@ -0,0 +1,102 @@ +
"; + if ($startIndex > 0) { + echo "previous " . ($page+1) . ""; + echo "  |  "; + } + + echo "next " . ($page+1) . ""; + echo "
files " . $startIndex . " - " . $endIndex . " on bucky:
"; + + for ($i=$startIndex; $i <= $endIndex; $i++) { + $row = mysql_fetch_array($query); + if (doubleCheck ($row)) + { + echo "
"; + echo $i . " "; + echo fileExt($row['filename'] . ": "); + echo "on "; + echo strtolower (date("D M j", $row['date'] )); + echo " "; + echo $row['username']; + echo " uploaded "; + echo "" . + "". + $row['filename']. + "". + ""; + echo " (" . sizeinK ($row['size']) . ")"; + } + } + } + + function doubleCheck ($row) { + if (!$row['filename'] || !$row['date'] || !$row['username'] || !$row['parent_id'] || !$row['size']) + { + echo "
(this file looks weird/null -- not listing)"; + return (false); + } else { + return (true); + } + } + + function fileExt ($inStr) { + return strtoupper (end(explode('.',$inStr))); + } + + function sizeinK($bytes) { + $size = $bytes / 1024; + if($size < 1024) { + $size = number_format($size, 2); + $size .= 'k'; + } else { if ($size / 1024 < 1024) { + $size = number_format($size / 1024, 2); + $size .= 'mb'; + } else if ($size / 1024 / 1024 < 1024) { + $size = number_format($size / 1024 / 1024, 2); + $size .= ' GB'; + } + } + return $size; + } +?> \ No newline at end of file -- cgit v1.2.3-70-g09d2