-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.php
More file actions
105 lines (97 loc) · 4.19 KB
/
profile.php
File metadata and controls
105 lines (97 loc) · 4.19 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
97
98
99
100
101
102
103
104
105
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Voloshin V.A.</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel=”stylesheet” href=”https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css” />
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container-nav">
<div class="logo-nav logo"></div>
</div>
<div class="container">
<div class="header">
<span class="text-first"><h1>Добро пожаловать на страничку</h1></span>
<span class="text-second"><h1>Черенкова Дмитрия</h1></span>
</div>
<div class="row">
<div class="col-12"><h1>Не много обо мне:</h1></div>
</div>
<div class="row opt">
<div class="col-5"><h1>Кто я?</h1></div>
<div class="col-8"><h2>Я студент ДВФУ на специальности "Компьютерная безопасность" С9122-10.05.01 безопасность компьютерных систем</h2></div>
<div class="col-4">
<div class="row img1"></div>
<div class="row"><p class="title-photo">Черенков Д.А</div>
</div>
</div>
<div class="row opt-down">
<div class="col-6"><h1>Чего хочу:</h1></div>
<div class="col-7">
<div class="row img2"></div>
<div class="row"><p class="title-photo2">Это просто кот</p></div>
</div>
<div class="col-9"><h2>Я хочу пиццы</h2></div>
</div>
</div>
<div class="container">
<div class="row">
<div class="button_js col-12">
<button id="myButton">DON`T CLICK THIS</button>
<p id="demo"></p>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-12">
<h1>
Привет, <?php echo $_COOKIE['User']; ?>
</h1>
</div>
<div class="col-12">
<form method="POST" action="/profile.php" enctype="multipart/form-data" name="upload">
<input class="form" type="text" name="title" placeholder="Заголовок поста">
<textarea name="text" cols="120" rows="20" placeholder="Здесь можете рассказать что то интересное..."></textarea>
<input type="file" name="file" /><br>
<button type="submit" class="btn_red" name="submit">Сохранить</button>
</form>
</div>
</div>
</div>
<script type="text/javascript" src="/js/button.js"></script>
</body>
</html>
<?php
if (!isset($_COOKIE['User'])) {
header("Location: index.php");
}
require_once('db.php');
$link = mysqli_connect('127.0.0.1', 'root', '123', 'dbCat');
if (isset($_POST['submit'])) {
$title = $_POST['title'];
$main_text = $_POST['text'];
if (!$title || !$main_text) die ("Заполните все поля");
$sql = "INSERT INTO posts (title, main_text) VALUES ('$title', '$main_text')";
if (!mysqli_query($link, $sql)) die ("Не удалось добавить пост");
}
if(!empty($_FILES["file"]))
{
if (((@$_FILES["file"]["type"] == "image/gif") || (@$_FILES["file"]["type"] == "image/jpeg")
|| (@$_FILES["file"]["type"] == "image/jpg") || (@$_FILES["file"]["type"] == "image/pjpeg")
|| (@$_FILES["file"]["type"] == "image/x-png") || (@$_FILES["file"]["type"] == "image/png"))
&& (@$_FILES["file"]["size"] < 102400))
{
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);
echo "Load in: " . "upload/" . $_FILES["file"]["name"];
}
else
{
echo "upload failed!";
}
}
?>