forked from cakenggt/Library-Of-Pybel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckout.php
More file actions
122 lines (110 loc) · 3.73 KB
/
checkout.php
File metadata and controls
122 lines (110 loc) · 3.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
<?php
/**
Library of PHPbel
Copyright (C) 2022 Cameron Ball
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
**/
if ($_GET['wall']>3) {
header("Location: https://libraryofbabel.cameronball.repl.co/?error=1");
die();
}
if ($_GET['wall']<0) {
header("Location: https://libraryofbabel.cameronball.repl.co/?error=1");
die();
}
if ($_GET['shelf']>4) {
header("Location: https://libraryofbabel.cameronball.repl.co/?error=1");
die();
}
if ($_GET['shelf']<0) {
header("Location: https://libraryofbabel.cameronball.repl.co/?error=1");
die();
}
if ($_GET['volume']>31) {
header("Location: https://libraryofbabel.cameronball.repl.co/?error=1");
die();
}
if ($_GET['volume']<0) {
header("Location: https://libraryofbabel.cameronball.repl.co/?error=1");
die();
}
if ($_GET['page']>409) {
header("Location: https://libraryofbabel.cameronball.repl.co/?error=1");
die();
}
if ($_GET['page']<0) {
header("Location: https://libraryofbabel.cameronball.repl.co/?error=1");
die();
}
require 'header.php';
$colon=':';
$page=(int)$_GET['page'];
$prevPage=(string)$page-1;
$nextPage=(string)$page+1;
$volume=(int)$_GET['volume'];
$prevVol=(string)$volume-1;
$nextVol=(string)$volume+1;
$shelf=(int)$_GET['shelf'];
$prevShelf=(string)$shelf-1;
$nextShelf=(string)$shelf+1;
$wall=(int)$_GET['wall'];
$prevWall=(string)$wall-1;
$nextWall=(string)$wall+1;
$query=$_GET['hex'] . $colon . $_GET['wall'] . $colon . $_GET['shelf'] . $colon . $_GET['volume'] . $colon . $_GET['page'];
$checkout=shell_exec("python lob.py --checkout '".$query."'");
$title=substr($checkout, 0, 33);
$content=substr($checkout, 34, -1);
?>
</head>
<body>
<br>
<a href="https://libraryofbabel.cameronball.repl.co">
<div>
<h1 class="ui header"><center><i class="book icon"></i>The Library of Babel</center></h1>
</div>
</a>
<br>
<center><div style="width: 95%;" class="ui padded raised text segment">
<h2 class="ui header">
<?php
echo $title;
echo '</h2><p style="text-align: left;overflow-wrap: break-word;">';
echo $content;
?>
</p>
</div>
<center><h3 class="ui header"><?php echo 'Page '.$page;?></h3></center>
<?php
$prevPageInt=(int)$prevPage;
$prevBtn=sprintf('<a href="https://libraryofbabel.cameronball.repl.co/checkout.php?hex=%s&wall=%s&shelf=%s&volume=%s&page=%s"<div class="ui animated button" tabindex="0"><div class="visible content">Previous Page</div><div class="hidden content"><i class="left arrow icon"></i></div></div></a>', $_GET['hex'], $_GET['wall'], $_GET['shelf'], $_GET['volume'], $prevPage);
if ($prevPageInt>0) {
echo $prevBtn;
}
?>
<a href="https://libraryofbabel.cameronball.repl.co">
<div class="ui vertical animated button" tabindex="0">
<div class="hidden content">Home</div>
<div class="visible content">
<i class="Home icon"></i>
</div>
</div>
</a>
<?php
$nextPageInt=(int)$nextPage;
$nextBtn=sprintf('<a href="https://libraryofbabel.cameronball.repl.co/checkout.php?hex=%s&wall=%s&shelf=%s&volume=%s&page=%s"<div class="ui animated button" tabindex="0"><div class="visible content">Next Page</div><div class="hidden content"><i class="right arrow icon"></i></div></div></a>', $_GET['hex'], $_GET['wall'], $_GET['shelf'], $_GET['volume'], $nextPage);
if ($nextPageInt<411) {
echo $nextBtn;
}
?>
</center>
<?php
require 'footer.php';
?>