-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnote.act.php
More file actions
executable file
·67 lines (55 loc) · 1.89 KB
/
note.act.php
File metadata and controls
executable file
·67 lines (55 loc) · 1.89 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
<?php
// Require the configuration before any PHP code as the configuration controls error reporting
require('./pw99-config.php');
// A settings page requires form functions
require_once('./includes/form_functions.inc.php');
// Include the header
$page_title = "$siteTitle";
include('./includes/header.html');
// Logged in or not?
if (isset($_SESSION['user_id'])) {
$userid = $_SESSION['user_id'];
// Writer archiving selected
if ( ($_SERVER['REQUEST_METHOD'] === 'POST') && (isset($_POST['pin'])) ) {
$note_id = $_POST['pin'];
$q = "UPDATE notes SET pinned=true WHERE writer_id='$userid' AND id='$note_id'";
$r = mysqli_query ($dbc, $q);
if (!$r) {
echo "Database error, give to tech support: <pre>$q</pre>"; exit();
} else {
header("Location: notes.php");
exit(); // Quit the script
}
// Writer restoring selected
} elseif ( ($_SERVER['REQUEST_METHOD'] === 'POST') && (isset($_POST['unpin'])) ) {
$note_id = $_POST['unpin'];
$q = "UPDATE notes SET pinned=false WHERE writer_id='$userid' AND id='$note_id'";
$r = mysqli_query ($dbc, $q);
if (!$r) {
echo "Database error, give to tech support: <pre>$q</pre>"; exit();
} else {
header("Location: notes.php");
exit(); // Quit the script
}
// Writer restoring selected
} elseif ( ($_SERVER['REQUEST_METHOD'] === 'POST') && (isset($_POST['undash'])) ) {
$note_id = $_POST['undash'];
$q = "UPDATE notes SET pinned=false WHERE writer_id='$userid' AND id='$note_id'";
$r = mysqli_query ($dbc, $q);
if (!$r) {
echo "Database error, give to tech support: <pre>$q</pre>"; exit();
} else {
header("Location: " . PW99_HOME);
exit(); // Quit the script
}
} else {
header("Location: " . PW99_HOME);
exit(); // Quit the script
}
} else {
header("Location: " . PW99_HOME);
exit(); // Quit the script
}
// Include the footer file to complete the template
require('./includes/footer.html');
?>