-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
294 lines (200 loc) · 9.64 KB
/
index.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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<?php
include "database/db.php";
include "database/jdf.php";
include_once "page/auth.php";
$num_blog = $db->prepare("SELECT * from post ");
$num_blog->execute();
$blogs = $num_blog->fetch();
$blogs_num = $num_blog->rowCount();
$views = $db->prepare(" SELECT count(*) from view where post = ?");
$views->bindValue(1 , $blogs['id']);
$views->execute();
$numviews = $views->fetch(PDO::FETCH_ASSOC);
foreach ($numviews as $numview) {}
$num_writter = $db->prepare("SELECT * from writter ");
$num_writter->execute();
$writters = $num_writter->fetch();
$writters_num = $num_writter->rowCount();
$num_register = $db->prepare("SELECT * from register ");
$num_register->execute();
$registers = $num_register->fetch();
$registers_num = $num_register->rowCount();
// ==================menu===================
$menu = $db->prepare("SELECT * from menu order by sort ");
$menu->execute();
// ========================= post======================
$post = $db->prepare("SELECT * from post ");
$post->execute();
function limit_words($string, $word_limit)
{
$words = explode(" ", $string);
return implode(" ", array_splice($words, 0, $word_limit));
}
?>
<html lang="fa">
<head>
<meta charset="UTF-8">
<title>weblog</title>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/style.css">
<script src="js/jquery-3.6.0.min.js"></script>
</head>
<body>
<?php
?>
<div class="container">
<br>
<!-- start headers -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">وبلاگ</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav">
<?php
while ($menus = $menu->fetch()) {
if ($menus['status'] == 1) {
?>
<li class="nav-item active">
<a class="nav-link" href="#"><?php echo $menus['title']; ?> </a>
</li>
<?php
}
}
?>
<?php if (isset ($_SESSION['login'])){ ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
حساب کاربری
</a>
<div class="dropdown-menu dropdown-menu-left" aria-labelledby="navbarDropdown">
<p class="dropdown-item"> خوش اومدی</p>
<a class="dropdown-item" href="page/log.php">خروج</a>
<a class="dropdown-item" href="Admin/index.php">پنل کاربری</a>
</div>
</li>
<?php
}
else
{
?>
<li class="nav-item">
<a class="nav-link" href="page/register.php">ثبت نام </a>
</li>
<li class="nav-item">
<a class="nav-link" href="page/login.php"> ورود</a>
</li>
<?php
}
?>
<div class="dropdown-menu dropdown-menu-left" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="page/login.php"> ورود </a>
</div>
</li>
<?php
?>
</ul>
<form class="form-inline my-2 my-lg-0 mr-auto">
<div><img src="image/logo.png" alt="" id="logo" ><b><p style="margin-right: 24px;">سجاد</p></b></div>
</form><br>
</div>
</nav>
<!-- end headers -->
<!-- start content -->
<br>
<hr>
<br>
<div>
<div class="row d-none d-lg-flex">
<div class="col-4 information-site">
<img src="image/blog1.svg" alt="">
<span>تعداد مقالات</span>:
<span><?php echo $blogs_num; ?></span>
</div>
<div class="col-4 information-site">
<img src="image/writer.svg" alt="">
<span>نویسندگان ما : <?php echo $writters_num; ?></span>
</div>
<div class="col-4 information-site">
<img src="image/member1.svg" alt="">
<span>تعداد کاربران : <?php echo $registers_num; ?></span>
</div>
</div>
</div>
<!-- end content -->
<br><br class="d-none d-lg-block"><br class="d-none d-lg-block">
<!-- start posts -->
<div>
<h5 style="padding: 10px;">
زندگی نامه بوکسور های مشهور
</h5>
<div class="row">
<?php while ($posts = $post->fetch()) { ?>
<div class="col-12 col-lg-4">
<div class="post-item">
<a href="page/singel.php?id= <?php echo $posts['id']; ?>" class="item-hover-btn"><img src="<?php echo $posts['image']; ?>" alt="" width="100%">
</a>
<div class="post-caption">
<p><a href="page/singel.php?id= <?php echo $posts['id']; ?>"> <?php echo $posts['title']; ?></a></p>
<span>
<?php echo limit_words($posts['content'], 20); ?>
</span>
<br><br>
<span class="seen-post">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-eye-fill" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M10.5 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z" />
<path fill-rule="evenodd" d="M0 8s3-5.5 8-5.5S16 8 16 8s-3 5.5-8 5.5S0 8 0 8zm8 3.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z" />
</svg><?php echo $numview; ?>
</span>
<span class="seen-post post-comment">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-chat-square-fill" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M2 0a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2.5a1 1 0 0 1 .8.4l1.9 2.533a1 1 0 0 0 1.6 0l1.9-2.533a1 1 0 0 1 .8-.4H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z" />
</svg>۷
</span>
<span class="float-left post-m">
<a href="">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-person-fill" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" />
</svg> <?php echo $posts['writter']; ?>
</a>
</span>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
<br><br>
<hr><br><br>
<!-- footer my website -->
<footer>
<div class="footer1">
<div class="container">
<div class="row">
<div class="col-12 col-lg-7"><br><br><br>
<form>
<a href="page/register.php"><input type="button" class="btn btn-success" value="عضویت در سایت ما"></a>
</form>
</div>
<div class="col-12 col-lg-5">
<div class="namad">
<img src="image/namad1.jpg" alt="">
<img src="image/namad2.jpg" height="166px" alt="">
</div>
</div>
</div>
</div>
</div>
<div class="footer2">
<p class="container">تمام حقوق این وبسایت برای اینجانب سجاددشتبان وزیر محفوظ است و هرگونه استفاده بدونه اجازه از ما پیگرد قانونی دارد</p>
</div>
</footer>
</body>
<script src="js/jquery-3.5.1.slim.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.js"></script>
</html>