Praca, praca
Took 5 hours 39 minutes
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
<!-- Podsumowanie -->
|
||||
<?php
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col card me-2">
|
||||
<div class="card-body">
|
||||
<h3>Ostatnie komentarze</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col card ms-2">
|
||||
<div class="card-body">
|
||||
<h3>Statystyki z 24 godzin</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
<!-- Posty -->
|
||||
<?php
|
||||
$posts = array();
|
||||
|
||||
// Pobierz posty
|
||||
$get_posts_query = "SELECT * FROM posts";
|
||||
$get_posts_res = mysqli_query($conn, $get_posts_query);
|
||||
|
||||
while($row = mysqli_fetch_assoc($get_posts_res)){
|
||||
array_push($posts, [
|
||||
"ID" => $row['id_post'],
|
||||
"Nazwa" => $row['name'],
|
||||
"Tytuł" => $row['title'],
|
||||
"Treść" => $row['content'],
|
||||
"Wyswietlenia" => $row['views'],
|
||||
"Dodano" => $row['added_at']
|
||||
]);
|
||||
}
|
||||
?>
|
||||
|
||||
<button type="button" name="add_post" class="btn btn-success" onclick="location.href='blog_panel/be_post.php';">Dodaj nowy post</button>
|
||||
<table class="table table-stripped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Tytuł</th>
|
||||
<th>Zawartość</th>
|
||||
<th>Wyświetlenia</th>
|
||||
<th>Dodano</th>
|
||||
<th>Akcja</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($posts as $post){
|
||||
if(strlen($post['Treść']) > 256){
|
||||
$post['Treść'] = substr($post['Treść'], 0, 253) . "...";
|
||||
}
|
||||
echo "
|
||||
<tr>
|
||||
<th>{$post['Nazwa']}</th>
|
||||
<td>{$post['Tytuł']}</td>
|
||||
<td>{$post['Treść']}</td>
|
||||
<td>{$post['Wyswietlenia']}</td>
|
||||
<td>{$post['Dodano']}</td>
|
||||
<td>
|
||||
<div class='d-flex'>
|
||||
<form method='POST' action='blog_panel/be_post.php'>
|
||||
<button class='btn btn-primary ms-2' type='submit' name='edit' value='{$post['ID']}'>Edytuj</button>
|
||||
</form>
|
||||
<form method='POST' action='be_panel.php'>
|
||||
<div class='d-flex'>
|
||||
<button class='btn btn-primary ms-2' type='submit' name='see' value='{$post['ID']}'>Zobacz</button>
|
||||
<button class='btn btn-danger ms-2' type='submit' name='delete' value='{$post['ID']}'>Usuń</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
Reference in New Issue
Block a user