-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
33 lines (30 loc) · 694 Bytes
/
Copy pathindex.php
File metadata and controls
33 lines (30 loc) · 694 Bytes
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
<?php
$notes = glob('notes/*.txt');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Notes</title>
</head>
<body>
<a href="note.php">New Note</a>
<h1>NOTES</h1>
<ul>
<?php foreach ($notes as $note): ?>
<?php
$name = basename($note, '.txt');
$lines = file($note);
$author = trim($lines[0] ?? '');
?>
<li>
<a href="note.php?file=<?php echo urlencode($name); ?>">
<?php echo htmlspecialchars($name); ?>
</a>
- <?php echo htmlspecialchars($author); ?>
</li>
<?php endforeach; ?>
</ul>
</body>
</html>