-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewtopic.php
More file actions
96 lines (86 loc) · 2.91 KB
/
newtopic.php
File metadata and controls
96 lines (86 loc) · 2.91 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
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Супер Форум</title>
<link rel="stylesheet" href="css/themes/base/jquery-ui.css"/>
<link rel="stylesheet" href="css/newtopic.css"/>
<script language="javascript" type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script src="js/ui/jquery-ui.js"></script>
<?php
include 'menu.php';
?>
</head>
<body>
<?php
if (isset($_SESSION['autorised'])) {
echo
<br>
<br>
<br>
<div class="post">
<div class="bgr">
<div class="postheader">
</div>
</div>
<div class="postbody">
<form action="post.php" method="post">
<div class="ui-widget">
<input name = "theme_title" type="text" class="lab htxt" placeholder="Название темы" id="name">
</div>
<textarea name = "theme_text" type="text" class="lab ptxt" placeholder="Текст сообщения"></textarea>
<input type="submit" value="Создать" class="button bb">
</form>
</div>
</div> ';
echo "<script>
jQuery(document).ready(function () {
$(\"#name\")
.keyup(function () {
$.ajax({
url: \"getposts.php?title=\"+encodeURI($(\"#name\").val()),
caching : false,
dataType: \"xml\",
success: function (xmlResponse) {
var re = $(\"post\", xmlResponse).map(function () {
return {
value: $(\"title\", this).text(),
creator: $(\"creator\", this).text(),
date: $(\"date\", this).text(),
topic: $(\"id\", this).text()
};
}).get();
$(function () {
$(\"#name\").autocomplete({
minLength: 1,
source: re
}).data(\"ui-autocomplete\")._renderItem = function (ul, item) {
var inner_html = '<a href = \"viewtopic.php?topic=' + item.topic + '\" target=\"_blank\">' + '<b>' + item.value + '</b> (created by <b>' + item.creator + '</b> on <b>' + item.date + ')</b></a>';
return $(\"<li></li>\")
.data(\"item.autocomplete\", item)
.append(inner_html)
.appendTo(ul);
};
});
}
});
});
});
</script>\n";
} else echo
<div class=\"post\">
<div class=\"bgr\">
<div class=\"postheader\">
</div>
</div>
<div class=\"postbody notlogpost\">
<div class = \"notloginfo\">you're not autorised!</div>
</div>
</div> ";
include 'footer.php';
?>
</body>
</html>