-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_process.php
More file actions
30 lines (28 loc) · 941 Bytes
/
add_process.php
File metadata and controls
30 lines (28 loc) · 941 Bytes
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
<?php include('./connectionDB.php');?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<?php
$title = $_GET['title'];
$title_2 = $_GET['title_2'];
$content = $_GET['content'];
$author = $_SESSION['username'];
$sql = "INSERT INTO articles (`title`, `second_title`, `author`, `text`)
VALUES ('$title', '$title_2', '$author', '$content')";
if (isset($author)) {
mysqli_query($connection, $sql); ?>
<script type="text/javascript">
alert("Пост успешно добавлен! Вы перенаправлены на главную страницу");
window.location = "index.php";
</script>
<?php } else { ?>
<script type="text/javascript">
alert("Сударь, вы не авторизированы! Авторизируйтесь для добавления поста");
window.location = "add.php";
</script>
<?php }?>
</body>
</html>