This repository was archived by the owner on Feb 8, 2022. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathadd_comment.php
More file actions
50 lines (50 loc) · 2.57 KB
/
Copy pathadd_comment.php
File metadata and controls
50 lines (50 loc) · 2.57 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
<?php
session_start();
include('exec/dbconnect.php');
include('exec/check_user.php');
if($_SESSION['loginin'] == '1'){
if($_POST['text'] == NULL){
echo '<meta charset="utf-8">Проверьте, вы вообще что-то писали на поле?<meta http-equiv="refresh" content="3;post'.$_POST['id'].'">';
exit();
}
//$_POST['text'] = str_replace('<', '<', $_POST['text']);
//$_POST['text'] = str_replace('>', '>', $_POST['text']);
$_POST['text'] = htmlentities($_POST['text'],ENT_QUOTES);
$_POST['text'] = str_replace(array("\r\n", "\r", "\n"), '<br>', $_POST['text']);
if($_SESSION['groupu'] == '1' OR $_SESSION['groupu'] == '2'){
//цвета
$_POST['text'] = str_replace('&Green', '<span style="color:green">', $_POST['text']);
$_POST['text'] = str_replace('&Red', '<span style="color:red">', $_POST['text']);
$_POST['text'] = str_replace('&Blue', '<span style="color:blue">', $_POST['text']);
$_POST['text'] = str_replace('&Violet', '<span style="color:violet">', $_POST['text']);
$_POST['text'] = str_replace('&Brown', '<span style="color:brown">', $_POST['text']);
//закрывалка
$_POST['text'] = str_replace('&Close', '</span>', $_POST['text']);
//фаст-фразочки
$_POST['text'] = str_replace('&hi', 'Приветствую!', $_POST['text']);
$_POST['text'] = str_replace('&oa', 'Мы добавили в OpenVK некоторые функции, а так-же исправили баги.', $_POST['text']);
$_POST['text'] = str_replace('&ia', 'Так-же Мы на данный момент планируем сделать ещё несколько функций.', $_POST['text']);
$_POST['text'] = str_replace('&bi', 'До скорых встреч!', $_POST['text']);
}
$_POST['text'] = str_replace('bold', '<b>', $_POST['text']);
$_POST['text'] = $_POST['text'].'</b>';
include('exec/dbconnect.php');
if(isset($_SESSION['id'])){
$id = $_SESSION['id'];
}
if(isset($_POST['id'])){
$idpost = $_POST['id'];
}
if(isset($_POST['text'])){
$text = $_POST['text'];
}
$q = "INSERT INTO `comments` (`id`, `iduser`, `idpost`, `text`, `date`) VALUES (NULL, '".$id."', '".$idpost."', '".$text."', '".time()."')"; // добавляем коммент
$q1 = $dbh1->prepare($q); // отправляем запрос серверу
$q1 -> execute();
$q1->fetch();
header('Location: post'.$_POST['id']);
}else if($_SESSION['loginin'] != '1'){
echo '<meta charset="utf-8">Хакеры? Интересно.<meta http-equiv="refresh" content="3;blank/..">';
exit();
}
?>