-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathedit.php
More file actions
75 lines (69 loc) · 2.14 KB
/
edit.php
File metadata and controls
75 lines (69 loc) · 2.14 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
<?php
error_reporting(E_ERROR);
include('config.php');
if (isset($_POST["save"])) {
if ($_POST['password'] != $password) {
echo "<script>";
echo "alert('Wrong password');";
echo "</script>";
exit();
}
Write();
header('Location:index.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
function Read()
{
$f = "links.txt";
echo file_get_contents($f);
}
function Write()
{
$f = "links.txt";
$fp = fopen($f, "w");
$data = $_POST["text"];
fwrite($fp, $data);
fclose($fp);
}
?>
<div class="card w-100" style="text-align: center;">
<form style="display: inline;" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
<textarea class="uk-textarea" name="text"><?php Read(); ?></textarea><br/>
<label>Password:
<input class="card w-50" type="password" name="password">
</label>
<button class="btn primary" title="Save changes" type="submit" name="save">Save</button>
</form>
<button class="btn" style="display: inline;" title="Back" style="margin-top: 1em;" onclick="location.href='index.php'">Back</button>
</div>
<div class="card w-100" style="text-align: center; margin-top: 2em;">
<?php echo $footer; ?>
</div>
</div>
</body>
</html>