blob: 3f9293900570640f90b83e8d9d4f7e92918ef7b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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;
}
?>
|