some index stats and instructions

This commit is contained in:
xfnw 2020-12-16 11:36:46 -05:00
parent 96a12ecd4b
commit 2fb507356e
2 changed files with 32 additions and 3 deletions

View file

@ -35,7 +35,7 @@ text-decoration: underline;
} }
.preview h1 { .preview h1, h2 {
margin: 0; margin: 0;
padding: 0; padding: 0;
margin-bottom: 5px; margin-bottom: 5px;

View file

@ -22,9 +22,10 @@ error_reporting(E_ALL);
</div> </div>
<?php <?php
$db = new PDO("sqlite:db.sqlite");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
if (isset($_GET['q']) && preg_replace('/\s+/', '', $_GET['q']) != '') { if (isset($_GET['q']) && preg_replace('/\s+/', '', $_GET['q']) != '') {
$db = new PDO("sqlite:db.sqlite");
$sql = 'SELECT * FROM indexed WHERE 1=1'; $sql = 'SELECT * FROM indexed WHERE 1=1';
@ -43,7 +44,6 @@ if (isset($_GET['q']) && preg_replace('/\s+/', '', $_GET['q']) != '') {
} }
$sql = $sql . ';'; $sql = $sql . ';';
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
$stmt = $db->prepare($sql); $stmt = $db->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
@ -93,6 +93,35 @@ if (isset($_GET['q']) && preg_replace('/\s+/', '', $_GET['q']) != '') {
if (!$results) if (!$results)
echo '<div class="box">No results.</div>'; echo '<div class="box">No results.</div>';
} else {
?>
<div class='box'>
<h2>welcome to searpl</h2>
i am an <a href='https://github.com/xfnw/searpl'>open source</a> search
engine that can find stuff :3
</div>
<div class='box'>
normal words inputted will be tags, a -tag will blacklist the tag and
there is also unsorted SQL LIKE syntax.
<br>
more stuff like site: coming soon!
</div>
<div class='box'>
i have
<strong>
<?php
echo $db->query('SELECT id FROM indexed ORDER BY id DESC LIMIT 1')->fetchColumn();
?>
</strong> pages indexed, using <strong>
<?php
echo round(filesize('db.sqlite')/1024/1024);
?>
</strong>mb of storage
</div>
<?php
} }
?> ?>
</div> </div>