forked from cakenggt/Library-Of-Pybel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
114 lines (102 loc) · 3.15 KB
/
search.php
File metadata and controls
114 lines (102 loc) · 3.15 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
<?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 (!isset($_GET['title'])) {
if (!isset($_GET['exclusiveContains'])) {
if (!isset($_GET['contains'])) {
header("Location: https://libraryofbabel.cameronball.repl.co/?error=2");
die();
} elseif ($_GET['contains']=='1') {
$mode='3';
} elseif ($_GET['exclusiveContains']=='1') {
$mode='2';
} elseif ($_GET['title']=='1') {
$mode='1';
} else {
header("Location: https://libraryofbabel.cameronball.repl.co/?error=2");
die();
}
}
}
require 'header.php';
$query=$_GET['search'];
if ($_GET['title']=='1') {
$going='True';
while ($going=='True') {
$result=shell_exec("python lob.py --title '".$query."'");
if ($result!='') {
$going='False';
}
}
$result=$result.':1';
$resultArray=explode(':',$result);
}
if ($_GET['contains']=='1') {
$going='True';
while ($going=='True') {
$result=shell_exec("python lob.py --pageInclude '".$query."'");
if ($result!='') {
$going='False';
}
}
$resultArray=explode(':',$result);
}
if ($_GET['exclusiveContains']=='1') {
$going='True';
while ($going=='True') {
$result=shell_exec("python lob.py --pageExclusive '".$query."'");
if ($result!='') {
$going='False';
}
}
$resultArray=explode(':',$result);
}
?>
</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 'Result';
echo '</h2><p style="text-align: left;overflow-wrap: break-word;">';
echo sprintf('<center style="overflow-wrap: break-word;">Location: %s<br>Wall: %s<br>Shelf: %s<br>Volume: %s<br>Page: %s</center>', $resultArray[0], $resultArray[1], $resultArray[2], $resultArray[3], $resultArray[4]);
?>
</p>
<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>
<a href="https://libraryofbabel.cameronball.repl.co/<?php echo sprintf('checkout.php?hex=%s&wall=%s&shelf=%s&volume=%s&page=%s"', $resultArray[0], $resultArray[1], $resultArray[2], $resultArray[3], $resultArray[4]);?>>
<div class="ui vertical animated button" tabindex="0">
<div class="hidden content">Link</div>
<div class="visible content">
<i class="linkify icon"></i>
</div>
</div>
</a>
</div></center>
<?php
require 'footer.php';
?>