-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnews.php
132 lines (132 loc) · 3.88 KB
/
news.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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<html>
<head>
<title>Новости</title>
<style>
#body a.id_news{
float: right;
font-size: 15px;
margin-top: -40px;
}
textarea#addnews{
width: 100%;
min-height: 40px;
resize: none;
}
h2{
-webkit-margin-before: 0.2em;
-webkit-margin-after: 0.2em;
}
div#addNews{
border: 1px solid #333;
width: calc( 100% - 20px );
padding: 10px;
box-shadow: 0 0 20px #333;
margin-bottom: 10px;
}
button#addnews{
margin-top: 20px;
border-radius: 5px;
border: 1px solid #555;
box-shadow: 0 0 10px #333;
background: #669;
color: white;
padding: 4px;
}
</style>
<script src="assest/js/jquery-3.2.0.min.js"></script>
<script>
function addnews() {
$("#addNews").slideDown('fast', changeclass)
$("#block_post").slideUp('fast', changeclass)
}
function closeNews() {
$("#addNews").slideUp('fast', changeclass)
$("#block_post").slideDown('fast', changeclass)
}
function changeclass() {}
</script>
<meta charset="utf-8">
<link type="text/css" rel="stylesheet" href="assest/css/style.css">
</head>
<body>
<?php
include('srchead');?>
<div id="body">
<?php
function defender_xss($arr){
$filter = array("<", ">");
foreach($arr as $num=>$xss){
$arr[$num]=str_replace ($filter, "|", $xss);
}
return $arr;
}
//используйте функцию перед обработкой входящих данных:
$_REQUEST=defender_xss($_REQUEST);
include('textnews');
if ((isset($_GET['id']))) {
if (($_GET['id']>=1)and($_GET['id']<=count($array))) {
$post = $_GET['id'];
?>
<div id="general_content">
<div id="post">
<h1>
<?php
echo ($array[$post-1]['title']); ?>
</h1>
<div id="st_news">
<?php
echo ($array[$post-1]['text']);?>
</div>
<div id="author">
<?php
echo ($array[$post-1]['author']);?>
</div>
</div>
</div>
<?php
}else{
?> <div id="general_content">
<div id="post">
Sorry, ID not found. Please, write <a href="mailto://support@codeground.ru">administration</a>.
</div><?php
} }
else {
?>
<div id="general_content">
<?php if (($type < 4)and(isset($_GET['page']) == false)and(isset($_GET['id']) == false)) {?>
<div id="addNews" style="display: none;">
<form action="addnews.php" method="POST">
<h2>Новая запись:</h2>
<a class="id_news" onclick="closeNews()"><b>X</b></a>
<i style="margin-left: 10px;"><b>Подсказка:</b> перед использованием кавычек <b>(")</b> ставьте <b>\</b> (иначе вся система слетит).</i><br>
Название:
<textarea name="title" cols="40" rows="1" id="addnews"></textarea>
Текст:
<textarea name="comment" cols="40" rows="10" id="addnews"></textarea>
Сокращенный текст:
<textarea name="fastComment" cols="40" rows="3" id="addnews"></textarea>
<button id="addnews">Отправить</button>
</form>
<div id="block_post">
<?php if (($type < 4) and (isset($_GET['page']) === false) and (isset($_GET['id']) === false)) {
?> <a onclick="addnews()"><div id="post"><h1 style="border: 0px;padding: 0px; margin: 0px;">Отправить запись</h1></div></a> <?php
} ?>
<?php } ?>
</div>
<div id="general_content">
<?php
$id = 3;
include("text_news");
?>
</div>
<?php }
?>
<?php if (isset($_GET['page']) === false) {?>
<?php }
include('srcnews');
?>
</div>
<?php include("srcfooter");
?>
</body>
</html>