-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload.php
252 lines (112 loc) · 3.69 KB
/
upload.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<?php include("core/json.php"); ?>
<?php include("functions.php"); ?>
<html>
<head>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="js/bootstrap.min.js"></script>
<?php
include("core/menu.php")
?>
</head>
<body>
<?php
if(!$_SESSION['user']['username']){
echo "<center><p>Access denied please login</p></center></body> <footer>
<center>© ". $copyright. "</center>
</footer>";
exit();
}elseif($_SESSION['user']['username'] == null){
echo "<center><p>Access denied please login</p></center></body> <footer>
<center>© ". $copyright. "</center>
</footer>";
exit();
}
?>
<div class="jumbotron jumbotron-fluid">
<div class="container">
<h1 class="display-4"><?php echo $username; ?></h1>
<p class="lead">
<?php if(!$allowuploading == true){
echo "<center><p>File uploading is disabled by the administrators</p></center>";
exit();
}
?>
<?php
if($_SESSION['error']){
?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<strong><?PHP echo $_SESSION['error']; ?></strong>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<?php
}elseif($_SESSION['success']){
?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong><?PHP echo $_SESSION['success']; ?></strong>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<?php
}
?>
<form id="uploadform" action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" enctype="multipart/form-data" >
<input class="btn btn-success" type="file" width="500px" name="file" id="fileInput" />
<br/>
<label>Thumbnale of post</label>
<br/>
<script>
//redundent
function toggleDiv(id) {
var div = document.getElementById(id);
div.style.display = div.style.display == "none" ? "block" : "none";
}
</script>
<input name="nop" placeholder="name of the post" class="form-control" />
<textarea name="description" class="form-control"></textarea>
<label for="type">type of content</label>
<select name="type" class="form-control" id="type">
<option>music</option>
<option>art</option>
<option>photography</option>
</select>
<input type="hidden" value="uploadform" name="<?php echo ini_get("session.upload_progress.name"); ?>">
<input type="submit" name="post_btn" class="btn btn-success" value="Post!" id="submit" >
<script>
// var btn = document.getElementById("submit");
btn.onclick = function() {
$('#upload').modal({
keyboard: false,
show: true,
backdrop: 'static'
})
};
</script>
<div class="modal" id="upload" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Uploading... </h5>
</div>
<div class="modal-body">
<p>Post uploading.</p>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</form>
</p>
</div>
</div>
</body>
<footer>
<center>© <?php print($copyright); ?></center>
</footer>
</html>