summaryrefslogtreecommitdiff
path: root/bPod/php/buckyf.php
diff options
context:
space:
mode:
Diffstat (limited to 'bPod/php/buckyf.php')
-rw-r--r--bPod/php/buckyf.php66
1 files changed, 66 insertions, 0 deletions
diff --git a/bPod/php/buckyf.php b/bPod/php/buckyf.php
new file mode 100644
index 0000000..3f92939
--- /dev/null
+++ b/bPod/php/buckyf.php
@@ -0,0 +1,66 @@
+
+
+
+
+ <?php
+
+ $kWarez = "http://www.carbonpictures.com/bucky/data/";
+
+ mysql_connect("localhost","tfarnon","blunderbus"); // lol QUEERS
+ mysql_select_db("bucky");
+
+ $pid = $_GET['pid'];
+
+ $page = ($endIndex - $startIndex);
+
+ $query = mysql_query("SELECT * FROM `files` where `parent_id` = $pid order by `filename` asc"); //" limit $startIndex, $endIndex");
+ $nrows = mysql_num_rows($query);
+ $rString = "&numItems=". $nrows;
+
+// display as querystring (&p=1)
+ for ($i = 0; $i < $nrows; $i++) {
+ $row = mysql_fetch_array($query);
+ $rString .= "&filetype" .$i ."=". fileExt($row['filename']);
+ $rString .= "&filename" .$i ."=". $row['filename'];
+ $rString .= "&username" .$i ."=". $row['username'];
+ $rString .= "&date" .$i ."=". strtolower (date("D M j", $row['date'] ));
+ $rString .= "&url" .$i ."=". $kWarez . $row['parent_id'] . "/" . str_replace(" ", "%20", $row['filename']);
+ $rString .= "&size" .$i ."=". sizeinK ($row['size']);
+ }
+ echo $rString;
+
+
+// --- UTILS.H --- //
+
+
+ function doubleCheck ($row) {
+ if (!$row['filename'] || !$row['parent_id'] || !$row['date'])
+ {
+ echo "<br>(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