-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathnotepad.php
71 lines (61 loc) · 2.52 KB
/
notepad.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
<?PHP
#Script laden zodat je nooit pagina buiten de index om kan laden
include("includes/security.php");
?>
<link href="includes/summernote/bootstrap.css" rel="stylesheet">
<link href="includes/summernote/summernote.css" rel="stylesheet">
<script>
$(document).ready(function () {
$('#summernote').summernote({
theme: 'yeti',
lang: "<?=GLOBALDEF_EDITORLANGUAGE?>",
toolbar: [
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'clear']],
['fontname', ['fontname']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['table', ['table']],
['insert', ['link', 'picture', 'video', 'hr']],
['view', ['fullscreen']]
]
});
});
</script>
Als je iets niet wil vergeten kan je het in je notepad zetten.<br/><br/>
<form method="post">
<?PHP
$SqlCount = mysql_query("SELECT id FROM notes WHERE `user_id`='" . $_SESSION['id'] . "'");
if (isset($_POST['update'])) {
$dirty_html_tekst = $_POST['notitie'];
require_once 'includes/htmlpurifier/library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
$tekst = $purifier->purify($dirty_html_tekst);
if ($tekst == '') {
echo showAlert('red','Je hebt niks ingevuld.');
} else {
if (mysql_num_rows($SqlCount) >= 1) {
// UPDATE
mysql_query("UPDATE notes SET text='" . mysql_real_escape_string($tekst) . "', postdate=NOW() WHERE `user_id`='" . $_SESSION['id'] . "'");
echo showAlert('green','Kladblok is vernieuwd!');
} else {
// INSERT
mysql_query("INSERT INTO notes(user_id,text,postdate) VALUES('" . $_SESSION['id'] . "','" . mysql_real_escape_string($tekst) . "',NOW())");
echo showAlert('green','Kladblok is vernieuwd!');
}
}
}
$qNotes = mysql_query("SELECT * FROM notes WHERE `user_id`='" . $_SESSION['id'] . "'");
if (mysql_num_rows($qNotes) > 0) {
$sNotes = mysql_fetch_assoc($qNotes);
} else {
$sNotes['text'] = '';
}
?>
<tr><td class=inhoud>
<textarea name="notitie" id="summernote" class="text_area"><?=$sNotes['text']?></textarea><br><br>
<button type="submit" name="update" class="button">Updaten</button>
</td></tr>
</form>