-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
110 lines (82 loc) · 1.99 KB
/
index.php
File metadata and controls
110 lines (82 loc) · 1.99 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
//logowanie b³êdów == 0
error_reporting(0);
$shortcut = addslashes(
$_GET['downloadid']
) ;
define('domena', 'htteu/');
define('path', '/.eu/');
define('ext','.html');
define('prefix','_');
$db['server'] = 'localhost';
$db['port'] = 3306;
$db['dbname'] = '_0002';
$db['username'] = '_0002';
$db['password'] = '';
$sql_id = mysql_connect($db['server'], $db['username'], $db['password']);
// TODO: pobieranie z konfigu
if (!$sql_id)
{
echo 'Ooops. We have a problem with database. Try again in a few minutes. If problem will not resolve, this is probably because wrong database configuration or maintenance.';
exit;
}
mysql_select_db($db['dbname'],$sql_id);
//mysql_close($sql_id);
function sql($query, $return)
{
//$zapytanie = "SELECT * FROM `_users`";
$queryid = mysql_query($query);
while ($wiersz = mysql_fetch_assoc($queryid)) {
print_r($wiersz);
}
}
$sql = "SELECT * FROM `_dl` WHERE shortcut = '$shortcut'";
$queryid = mysql_query($sql);
if (!$wiersz = mysql_fetch_assoc($queryid))
{
echo 'Invalid url. Check again.';
exit;
}
elseif (!is_file($wiersz['file']))
{
echo 'File not found. Probably deleted';
exit;
}
else{
$sql = 'UPDATE `_dl` SET `count` = \'' . ($wiersz['count'] + 1) .
'\' WHERE `id` = ' . ($wiersz['id']);
$queryid = mysql_query($sql);
if (strpos($wiersz['file'], '.png') !== FALSE || strpos($wiersz['file'], '.jpg') !== FALSE)
header('Content-Type: image/png');
else {
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename='.basename($wiersz['file']));
}
readfile($wiersz['file']);
exit;
print_r($wiersz);
}
?>
<pre><?php
print_r($_GET);
print_r($_SERVER);
?></pre>
<?php
$dl = Array(
's' => '../smile.jpg',
'x' => '../eu-home.png',
'y' => '../../114.jpg',
'none' => ''
);
echo '<pre>';
print_r($dl);
echo '
</pre>';
if (array_key_exists($_GET['key'] , $dl))
{
$url = $dl[$_GET['key']];
$name = explode('/' , $url);
$name = $name[count($name)- 1];
echo "<a href='$url'>$name</a>";
}
?>