-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdl.php
55 lines (48 loc) · 1.14 KB
/
dl.php
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
<?php
/************************
* DELETE ME *
*************************
this file was created because download.php bugged
if download.php is fully working delete this file
*/
require_once(__DIR__ . "/global.php");
session_start();
if (IsLoggedIn())
{
$id = 7;
$username = $_SESSION['Username'];
$cert_file=CERT_PATH . $username . "-" . $id . ".ovpn";
if (file_exists($cert_file))
{
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($cert_file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($cert_file));
ob_clean();
flush();
readfile($cert_file);
exit();
}
else
{
echo "file not found $cert_file <a href=\"index.php\">back</a>";
}
}
else
{
?>
<div class="login-page">
<div class="form">
<form action="login.php" class="login-form">
<a>Please login first.</br></a>
<button type="submit">login</button>
</form>
</div>
</div>
<?php
}
?>