<div id="profile">
<?php
require 'users/'. $login .'/index.php';
//это не относиться к постам
?>
<?php
function getPost(){
global $connection, $row;
$num = $row['id'];
$sql = "SELECT * FROM `posts` WHERE `user_id` = '{$num}' ORDER BY `id` DESC ";
# ^ хочу достать все посты, с id пользователя
$result = mysqli_query($connection, $sql);
$posts = mysqli_fetch_all($result, MYSQLI_ASSOC);
return $posts;
} ?>
<?php
$posts = getPost();
?>
<?php if($posts == true) : ?>
<div id="photos1">
<?php foreach($posts as $post): ?>
<!-- POST START -->
<div id="post">
<div id="who-post">
<div id="usr-p">
<style>
#usr-p {
background: white;
width: 50px;
height: 50px;
border-radius: 100%;
}
</style>
</div>
<div id="who-name">
<?php
echo $name['login'];
?>
</div>
<h2 id="date-post"><?php echo $post['time']; ?></h2>
</div>
<h2 id="name-post"><?php echo $post['content']; ?></h2>
<?php if( $post['image'] == NULL) : ?>
<?php else : ?>
<div id="post-img">
<style> #post-img { background-image: url("<?php echo $post['image']; ?>"); } </style>
</div>
<?php endif; ?>
<hr id="und1"> <style>#und1 { margin-left: auto; margin-right:auto; width:780px; padding: 0px; background-color: #6e6969; }</style>
<div id="post-liked"> <style> #post-liked {display: flex;} </style>
<div id="love-post"></div>
<h2>0</h2>
<div id="comm-post"></div>
<h2>0</h2>
</div>
</div>
</div>
<!-- POST END -->
<?php endforeach; ?>
</div>
<?php else :?>
<h2 id="u-d">Пользователь пока еще ничем не поделился <span id="green-c">:(</span></h2>
<?php endif; ?>
#photos1 {
width: 800px;
margin-left: auto;
margin-right: auto;
margin-top: 10px;
border-radius: 5px;
display: block;
height: 1000px;
}
#post {
color: white;
width: 780px;
padding: 10px;
margin-bottom: 100px;
margin-top: 100px;
min-height: 60px;
background-color: #524e4e;
margin-top: 10px;
font-family: 'Montserrat', sans-serif;
border-radius: 5px;
margin-left: auto;
margin-right: auto;
}
#who-post {
width: 800px;
display: flex;
color: white;
font-family: 'Montserrat', sans-serif;
height: 50px;
}
#usr-p {
background: white;
width: 50px;
height: 50px;
border-radius: 100%;
}
#who-name {
display: flex;
justify-content: center;
align-items: center;
margin-left: 10px;
font-size: 25px;
}
#date-post {
font-size: 23px;
display: flex;
align-items: center;
justify-content: center;
color: rgb(124, 122, 122);
margin-right: 30px;
margin-left: auto;
}
#name-post {
margin-bottom:15px;
}
#post-img { background-image: url("<?php echo $post['image']; ?>"); } /*это из php*/
#und1 {
margin-left: auto;
margin-right:auto;
width:780px;
padding: 0px;
background-color: #6e6969;
}
$to = $name['mail'];
$subject = "contactus";
$message = '
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300&display=swap" rel="stylesheet">
</head>
<body>
<div id="mail-box" style=" margin-top:5px;
width: 300px;
height: 400px;
margin-left: auto;
margin-right: auto;
background-color:rgb(92, 88, 88) ;">
<div id="logo"style=" color: rgb(59, 252, 59);
font-family: "Quicksand", sans-serif;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
max-height: 60px;">
<h1>contactus</h1>
</div>
<hr id="rh">
<h2 id="text"
style="
color: white;
font-family: "Montserrat", sans-serif;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 18px;"
>Привет,<span id="g-w" style="color: rgb(59, 252, 59);
margin: 3px;">пароль123</span>!</h2>
<div id="code-r" style="color: white;
display: flex;
justify-content: center;
align-items: center;
margin-left: auto;
margin-right: auto;
text-align: center;
margin-top: 33px;
margin-bottom: 33px;
font-size: 26px;
max-height: 60px;
font-family: "Montserrat", sans-serif;">
<h1>
734726
</h1>
</div>
<h4 id="wh" style=" color: grey;
display: flex;
justify-content: center;
align-items: center;
margin-left: auto;
margin-right: auto;
text-align: center;
font-family: "Montserrat", sans-serif;">
Что-бы поменять свой пароль, нужно ввести код на том устройстве, с которого вы сделали этот запрос.
</h4>
</div>
</body>
</html>
';
$headers = "Content-type: text/html; charset=utf-8\r\n";
$headers .= "From: От кого письмо <from@example.com>\r\n";
$headers .= "Reply-To: reply-to@example.com\r\n";
mail($to, $subject, $message, $headers);