-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.php
More file actions
171 lines (155 loc) · 4.73 KB
/
index.php
File metadata and controls
171 lines (155 loc) · 4.73 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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html lang="en">
<head>
<title>Cheap Hosting</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="description" content="Html Hoster">
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f4f4f4;
}
.banner {
text-align: center;
background-color: #e74c3c;
color: white;
padding: 20px 0;
border-radius: 8px;
margin-bottom: 20px;
font-size: 24px;
}
.banner span {
display: block;
font-size: 16px;
margin-top: 5px;
}
.container {
max-width: 90%;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
border: 1px solid #ddd;
position: relative;
}
input[type="file"], input[type="submit"] {
margin-bottom: 15px;
padding: 12px;
width: calc(100% - 24px);
display: block;
margin-left: auto;
margin-right: auto;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type="submit"] {
background-color: #e74c3c;
color: white;
border: none;
cursor: pointer;
transition: background-color 0.3s;
border-radius: 4px;
padding: 12px 20px;
width: 100%;
display: block;
}
input[type="submit"]:hover {
background-color: #c0392b;
}
.watermark {
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
font-size: 12px;
color: #ccc;
}
.hosted-url-box {
padding: 10px;
background-color: #f9f9f9;
border: 1px solid #ddd;
border-radius: 4px;
margin-top: 20px;
word-wrap: break-word;
max-width: 90%;
margin-left: auto;
margin-right: auto;
}
.custom-btn {
background-color: #3498db;
color: white;
border: none;
cursor: pointer;
font-size: 10px;
text-align: center;
}
@media (max-width: 600px) {
.custom-btn {
width: 100%;
z-index: 9999;
}
}
@media (max-width: 600px) {
.container {
padding: 15px;
}
input[type="file"], input[type="submit"] {
padding: 10px;
}
.banner {
font-size: 18px;
}
.banner span {
font-size: 14px;
}
.watermark {
font-size: 10px;
}
}
</style>
</head>
<body>
<div class="banner">
<h1>Cheap Hosting</h1>
<span>Your solution for affordable hosting</span>
</div>
<div class="container">
<form method="post" enctype="multipart/form-data">
<input type="file" name="uploadedFile">
<input type="submit" value="Upload">
</form>
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['uploadedFile'])) {
$uploadDir = 'uploads/';
$allowedExtension = 'html';
$fileExtension = pathinfo($_FILES['uploadedFile']['name'], PATHINFO_EXTENSION);
if (strtolower($fileExtension) !== $allowedExtension) {
echo "<div>Error: Only HTML files are allowed.</div>";
} else {
if (!file_exists($uploadDir) && !is_dir($uploadDir)) {
mkdir($uploadDir);
}
$uploadedFile = $uploadDir . basename($_FILES['uploadedFile']['name']);
if (move_uploaded_file($_FILES['uploadedFile']['tmp_name'], $uploadedFile)) {
$fileName = basename($_FILES['uploadedFile']['name']);
$hostedURL = "http://{$_SERVER['HTTP_HOST']}/$uploadedFile";
echo "<div class='hosted-url-box'>File uploaded successfully. Hosted URL: <a href='$hostedURL'>$hostedURL</a></div>";
} else {
echo "<div>Error uploading file.</div>";
}
}
}
?>
<div class="watermark">Hosted on: <?php echo $_SERVER['HTTP_HOST']; ?></div>
</div>
<center>
<a href="https://t.me/DEVSNP">
<button class="btn-11 custom-btn" style="width: 40vw; height: 40px; margin-top: 10px;"><b style="color: white;">Made by Nep Coder</b></button>
</a>
</center>
</body>
</html>