-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage_users.php
214 lines (196 loc) · 10.8 KB
/
page_users.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?php
include ("config.php");
include ("bd.php");
if (isset($_SESSION['id']))
{
$id = $_SESSION['id'];
}
if (!empty($_SESSION['email']) and !empty($_SESSION['password']))
{
$email = $_SESSION['email'];
$password = $_SESSION['password'];
$result2 = mysql_query("SELECT * FROM user WHERE email_user='$email' AND pass_user='$password'",$db);
$myrow2 = mysql_fetch_array($result2);
if (empty($myrow2['id_user']))
{
exit("Вход на эту страницу разрешен только зарегистрированным пользователям!1");
}
}
else
{
var_dump($_SESSION['password']);
exit("Вход на эту страницу разрешен только зарегистрированным пользователям!2");
}
$user_id = $_GET['id'];
$result3 = mysql_query("SELECT * FROM advert WHERE id_users='$user_id'",$db);
$num=mysql_num_rows($result3);
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Профиль</title>
</head>
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="css/shop-homepage.css" rel="stylesheet">
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<body>
<?php
include("navbar.php");
?>
<br>
<br>
<div class="container">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="card-title mb-4">
<div class="d-flex justify-content-start">
<div class="image-container">
<?php
$result = mysql_query("SELECT * FROM user WHERE id_user='$user_id'",$db);
$myrow = mysql_fetch_array($result);
?>
<?php echo '<img class="img-thumbnail" style="width: 150px; height: 150px" src="data:image/jpeg;base64,' . base64_encode( $myrow['photo_user'] ) . '" />'?>
</div>
<div class="userData ml-3">
<h2 class="d-block" style="font-size: 1.5rem; font-weight: bold"><a href="javascript:void(0);"><?php echo $myrow['fio_user']; ?></a></h2>
<h6 class="d-block"><a href="javascript:void(0)"><?php echo $num; ?></a> Объявления было создано пользователем</h6>
<?php
if($myrow['block_user']=='0')
{
?>
<a href="blocked.php?id=<?php echo $myrow['id_user'];?>" class="btn btn-danger">Заблокировать пользователя </a>
<?php
if($myrow['admin_user']==0)
{
?>
<a href="admined.php?id=<?php echo $myrow['id_user'];?>" class="btn btn-primary">Назначить администратором</a>
<?php
}
else
{
?>
<a href="#" class="btn btn-success">Администратор</a>
<?php
}}
else
{
?>
<a href="#" class="btn btn-danger">Заблокирован</a>
<a href="unblocked.php?id=<?php echo $myrow['id_user'];?>" class="btn btn-primary">Разблокировать пользователя </a>
<?php
}
?>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<ul class="nav nav-tabs mb-4" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="basicInfo-tab" data-toggle="tab" href="#basicInfo" role="tab" aria-controls="basicInfo" aria-selected="true">Информация профиля</a>
</li>
<li class="nav-item">
<a class="nav-link" id="ads-tab" data-toggle="tab" href="#ads" role="tab" aria-controls="ads" aria-selected="false">Мои объявления</a>
</li>
</ul>
<div class="tab-content ml-1" id="myTabContent">
<div class="tab-pane fade show active" id="basicInfo" role="tabpanel" aria-labelledby="basicInfo-tab">
<div class="row">
<div class="col-sm-3 col-md-2 col-5">
<label style="font-weight:bold;">ФИО</label>
</div>
<div class="col-md-8 col-6">
<?php echo $myrow['fio_user']; ?>
</div>
</div>
<hr />
<div class="row">
<div class="col-sm-3 col-md-2 col-5">
<label style="font-weight:bold;">E-mail</label>
</div>
<div class="col-md-8 col-6">
<?php echo $myrow['email_user']; ?>
</div>
</div>
<hr />
<div class="row">
<div class="col-sm-3 col-md-2 col-5">
<label style="font-weight:bold;">Обо мне</label>
</div>
<div class="col-md-8 col-6">
<?php echo $myrow['info_user']; ?>
</div>
</div>
<hr />
<div class="row">
<div class="col-sm-3 col-md-2 col-5">
<label style="font-weight:bold;">Телефон</label>
</div>
<div class="col-md-8 col-6">
<?php echo $myrow['phone_user']; ?>
</div>
</div>
<hr />
<div class="row">
<div class="col-sm-3 col-md-2 col-5">
<label style="font-weight:bold;">Адрес</label>
</div>
<div class="col-md-8 col-6">
<?php echo $myrow['address_user']; ?>
</div>
</div>
<hr />
</div>
<div class="tab-pane fade" id="ads" role="tabpanel" aria-labelledby="ads-tab">
<div class="container-fluid">
<div class="col-lg-12">
<div class="row">
<?php
$resultUs = mysql_query("SELECT * FROM user WHERE id_user='$user_id'",$db);
while($myrowUs = mysql_fetch_array($resultUs))
{
$resultAd = mysql_query("SELECT * FROM advert WHERE id_users='$user_id'",$db);
while($myrowAd = mysql_fetch_array($resultAd))
{
?>
<div class="col-lg-6 col-md-6 mb-4 ">
<div class="card h-100 " style="text-align: center!important;">
<?php echo '<a><img class="card-img-top" style="height: 400px;" src="data:image/jpeg;base64,' . base64_encode( $myrowAd['photo_ad'] ) . '"alt="" /></a>' ?>
<div class="card-body" >
<h4 class="card-title ">
<a href="#"><?php echo $myrowAd['name_ad']?></a>
</h4>
<h5><?php echo $myrowAd['description_ad']?></h5>
<p class="card-text"><?php echo $myrowAd['item_ad']?> </p>
<a class="btn btn-primary" href="viewAds.php?id=<?php echo $myrowAd['id_ad'];?>" role="button">Посмотреть</a>
<a class="btn btn-primary" href="change_ad.php?id=<?php echo $myrowAd['id_ad'];?>" role="button">Редактировать</a>
</div>
</div>
</div>
<?php
}}
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include("footer.php");
?>
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
</body>
</html>