-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.php
More file actions
112 lines (75 loc) · 1.94 KB
/
Copy pathdata.php
File metadata and controls
112 lines (75 loc) · 1.94 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
// et saada ligi sessioonile
require("functions.php");
//ei ole sisseloginud, suunan login lehele
if(!isset ($_SESSION["userId"])) {
header("Location: login.php");
exit();
}
//kas kasutaja tahab välja logida
// kas aadressireal on logout olemas
if (isset($_GET["logout"])) {
session_destroy();
header("Location: login.php");
exit();
}
if ( isset($_POST["note"]) &&
isset($_POST["color"]) &&
!empty($_POST["note"]) &&
!empty($_POST["color"])
) {
$note = cleanInput($_POST["note"]);
saveNote($note, $_POST["color"]);
}
$notes = getAllNotes();
//echo "<pre>";
//var_dump($notes);
//echo "</pre>";
?>
<h1>Data</h1>
<p>
Tere tulemast <a href="user.php"><?=$_SESSION["userEmail"];?></a>!
<a href="?logout=1">Logi välja</a>
</p>
<h2><i>Märkmed</i></h2>
<h2><i>Märkmed</i></h2>
<form method="POST">
<label>Märkus</label><br>
<input name="note" type="text">
<br><br>
<label>Värv</label><br>
<input name="color" type="color">
<br><br>
<input type="submit">
</form>
<h2>arhiiv</h2>
<?php
//iga liikme kohta massiivis
foreach ($notes as $n) {
$style = "width:100px;
float:left;
min-height:100px;
border: 1px solid gray;
background-color: ".$n->noteColor.";";
echo "<p style=' ".$style." '>".$n->note."</p>";
}
?>
<h2 style="clear:both;">Tabel</h2>
<?php
$html = "<table>";
$html .= "<tr>";
$html .= "<th>id</th>";
$html .= "<th>Märkus</th>";
$html .= "<th>Värv</th>";
$html .= "</tr>";
foreach ($notes as $note) {
$html .= "<tr>";
$html .= "<td>".$note->id."</td>";
$html .= "<td>".$note->note."</td>";
$html .= "<td>".$note->noteColor."</td>";
$html .= "<td><a href='edit.php?id=".$note->id."'>edit.php</a></td>";
$html .= "</tr>";
}
$html .= "</table>";
echo $html;
?>