-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathget.php
152 lines (137 loc) · 5.68 KB
/
get.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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
if(!isset($_GET['id'])){
header("Location:404.php");
die();
}
require 'db_connect.php';
$id=$_GET['id'];
$query="SELECT * FROM filepath Where fid = '$id'";
$result=mysqli_query($conn,$query);
$row=mysqli_fetch_assoc($result);
$file_id=$row['fid'];
if ($file_id!=$id) {
header("Location:404.php");
die();
}
$file_down = $row['file_down'];
$file_down=$file_down+1;
$file_path = $row['file_path'];
$file_name = $row['file_name'];
$file_type = $row['file_type'];
$file_size = $row['file_size'];
$query =
"UPDATE filepath SET file_down = '$file_down' Where fid = '$id'";
$result=mysqli_query($conn,$query);
$file_size=formatSizeUnits($file_size);
function formatSizeUnits($bytes)
{
if ($bytes >= 1073741824)
{
$bytes = number_format($bytes / 1073741824, 2) . ' GB';
}
elseif ($bytes >= 1048576)
{
$bytes = number_format($bytes / 1048576, 2) . ' MB';
}
elseif ($bytes >= 1024)
{
$bytes = number_format($bytes / 1024, 2) . ' KB';
}
elseif ($bytes > 1)
{
$bytes = $bytes . ' bytes';
}
elseif ($bytes == 1)
{
$bytes = $bytes . ' byte';
}
else
{
$bytes = '0 bytes';
}
return $bytes;
}
?>
<!DOCTYPE html>
<html>
<head>
<base href="/">
<meta charset="utf-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="icon" href="assets/logo.png" type="image/png" sizes="16x16">
<!-- Seo Meta Tags -->
<title><?php echo $file_name;?> - HostMyFile</title>
<link href='assets/logo.png' rel='icon' type='image/x-icon'/>
<!-- Twitter Card data -->
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="<?php echo $file_name;?> - HostMyFile" />
<meta name="twitter:description" content="<?php echo $file_name;?> - HostMyFile" />
<meta name="twitter:image" content="http://hostmyfile.xyz/assets/logo.png" />
<!-- Facebook Open Graph data -->
<meta property="og:title" content="<?php echo $file_name;?> - HostMyFile"/>
<meta property="og:type" content="article"/>
<meta property="og:url" content="hostmyfile.xyz" />
<meta property="og:image" content="http://hostmyfile.xyz/assets/logo.png" />
<meta property="og:description" content="<?php echo $file_name;?> - HostMyFile" />
<meta property="og:site_name" content="HostMyFile" />
<!-- Google+ Meta Tags. -->
<meta itemprop="name" content="<?php echo $file_name;?> - HostMyFile">
<meta itemprop="description" content="<?php echo $file_name;?> - HostMyFile">
<meta itemprop="image" content="assets/logo.png">
<link rel="stylesheet" href="css/fontawesome.css">
<link rel="stylesheet" href="css/mdb.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato">
<script type="text/javascript">
function download() {
var bttn = document.getElementById('downbtn');
bttn.value="Starting Download...";
setTimeout(myFunction, 1000);
location.href = '<?php echo $file_path ?>' ;
}
function myFunction(){
var bttn = document.getElementById('downbtn');
bttn.value="Download";
}
</script>
</head>
<body>
<header>
<div style="margin-top: 10px;">
<center>
<h1><a class="navbar-brand" href="<?php echo "http://".$_SERVER['HTTP_HOST']; ?>"><strong style="font-size: 1.5em">HostMyFile</strong></a></h1>
</center>
</div>
</header>
<div class="container-fluid text-center window" style="padding: 30px; margin-top: 30px; background-color: #b0aac2">
<div class="row">
<div class="col-md-6" style="padding: 30px">
<br><label>File Name:</label>  <?php echo $file_name ?>
<br><label>File Type :</label>  <?php echo $file_type ?>
<br><label>File Size :</label>  <?php echo $file_size ?>
</div>
<div class="col-md-6">
<a ><input type="button" id="downbtn" name="btn" class="btn-success btn btn-lg center-block downbtn" style="margin-top: 70px;margin-bottom: 40px" onclick="download()" value="Download"></a>
</div>
</div>
</div>
<div class="container-fluid specs" style="margin-top: 40px;">
<div class="row">
<div class="col-sm-4 col-xs-12 pro">
<i class="fa fa-user-secret" aria-hidden="true"></i>
<p class="text-center" style="font-size: 25px;">Safe and Anonymous</p>
</div>
<div class="col-sm-4 col-xs-12 pro">
<i class="fa fa-file-pdf-o" aria-hidden="true"></i>
<p class="text-center" style="font-size: 25px;">Rich File Support</p>
</div>
<div class="col-sm-4 col-xs-12 pro">
<i class="fa fa-globe" aria-hidden="true"></i>
<p class="text-center" style="font-size: 25px;">No Country Restriction</p>
</div>
</div>
</div>
</body>
</html>