diff options
| author | Jules Laplace <carbon@melanarchy.org> | 2013-08-02 17:14:26 -0500 |
|---|---|---|
| committer | Jules Laplace <carbon@melanarchy.org> | 2013-08-02 17:14:26 -0500 |
| commit | 79670053c7247d3a49b607960efd284e93f057e5 (patch) | |
| tree | 9617f6eefa38b2686ae409bf75cc27a340444eda /bPod/php/buckyf.php | |
| parent | c53827d5d044ae5ca7ebb27acb404b7a8988918e (diff) | |
install.pl
Diffstat (limited to 'bPod/php/buckyf.php')
| -rw-r--r-- | bPod/php/buckyf.php | 66 |
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 |
