-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.php
executable file
·72 lines (66 loc) · 2.32 KB
/
index.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
<?php
// CORS policy to allow the submitted page to read the response
header('Access-Control-Allow-Origin: *');
error_reporting(E_ERROR);
include('config.php');
?>
<!DOCTYPE html>
<html lang="en" data-theme="<?php echo $theme; ?>">
<!-- Author: Dmitri Popov, dmpop@linux.com
License: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt -->
<head>
<title><?php echo $title; ?></title>
<meta charset="utf-8">
<link rel="shortcut icon" href="favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/lit.css" />
<link rel="stylesheet" href="css/styles.css" />
<!-- Suppress form re-submit prompt on refresh -->
<script>
if (window.history.replaceState) {
window.history.replaceState(null, null, window.location.href);
}
</script>
</head>
<body>
<div class="c">
<div style="text-align: center;">
<img style="display: inline; height: 2.5em; vertical-align: middle;" src="favicon.svg" alt="logo" />
<h1 class="text-center" style="display: inline; margin-left: 0.19em; vertical-align: middle; letter-spacing: 3px; margin-top: 0em; color: #ce6a85ff;"><?php echo $title; ?></h1>
</div>
<?php
if (file_exists($link_file)) {
$lines = file($link_file);
} else {
echo "<script>";
echo "alert('No links found');";
echo "</script>";
}
$rnd_link = $lines[array_rand($lines)];
echo '<div class="card w-100" style="text-align: center;">';
echo '<p>Total links: <strong>' . count($lines) . '</strong></p>';
echo '<p>' . $rnd_link . '</p>';
echo '</div>';
?>
<div class="card w-100" style="text-align: center;">
<form style="margin-top: 2em; margin-bottom: 2em; display: inline;" method='GET' action='filter.php'>
<label for="filter">Filter:</label>
<input class="card w-50" type='text' name='filter' id='filter'>
<button class="btn primary" title="Filter links">Filter</button>
</form>
<button class="btn primary" title="Edit link list" onclick='window.location.href = "edit.php"'>Edit</button>
<button class="btn primary" title="Add new link" onclick='window.location.href = "add.php"'>Add link</button>
</div>
<div class="text-left">
<?php
foreach ($lines as $line) {
echo $line;
}
?>
</div>
<div class="card w-100" style="text-align: center; margin-top: 2em;">
<?php echo $footer; ?>
</div>
</div>
</body>
</html>