114 lines
4.0 KiB
PHP
114 lines
4.0 KiB
PHP
|
<?php
|
||
|
if( !isset( $_SESSION ) ) session_start();
|
||
|
if(empty($_SESSION['user'])){
|
||
|
header('Location: login.php');
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<title>Panel CMS</title>
|
||
|
<meta charset="utf-8">
|
||
|
<meta name="robots" content="noindex,nofollow" />
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
|
|
||
|
|
||
|
<!-- JS STYLE AND BS -->
|
||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||
|
<link rel="stylesheet" href="css/style.css">
|
||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||
|
<link rel="stylesheet" href="../css/style2.css">
|
||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css">
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="wrapper">
|
||
|
<nav id="sidebar">
|
||
|
<div class="sidebar-header">
|
||
|
<h3>Panel użytkownika</h3>
|
||
|
</div>
|
||
|
|
||
|
<ul class="list-unstyled components">
|
||
|
<li><a href="">Strona główna</a></li>
|
||
|
<li class="active"><a target="zawartosc" name="dodajemy" href="index.php">Posty</a></li>
|
||
|
<li><a href="newsy.php">Newsy</a></li>
|
||
|
</ul>
|
||
|
</nav>
|
||
|
<div id="content">
|
||
|
|
||
|
<nav class="navbar navbar-default">
|
||
|
<div class="container-fluid">
|
||
|
<div class="navbar-header">
|
||
|
|
||
|
<button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
|
||
|
<i class="glyphicon glyphicon-align-left"></i>
|
||
|
<span>Toggle Sidebar</span>
|
||
|
</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</nav>
|
||
|
<table class="table table-striped">
|
||
|
<tr>
|
||
|
<th>ID Postu</th>
|
||
|
<th>Tytuł</th>
|
||
|
<th>Opis</th>
|
||
|
<th>Treść</th>
|
||
|
<th>Data dodania</th>
|
||
|
<th>Data modyfikacji</th>
|
||
|
</tr>
|
||
|
<?php
|
||
|
$trash = '';
|
||
|
include "../settings/db_connect.php";
|
||
|
if ($sql = $mysqli->prepare("SELECT * FROM post ORDER BY data_dodania"))
|
||
|
{
|
||
|
$sql->execute();
|
||
|
$sql->bind_result($post_id,$trash,$title,$description,$main,$date,$mod_date);
|
||
|
while ($sql->fetch())
|
||
|
{
|
||
|
echo "<tr>
|
||
|
<td>$post_id</td>
|
||
|
<td>$title</td>
|
||
|
<td>$description</td>
|
||
|
<td>$main</td>
|
||
|
<td>$date</td>
|
||
|
<td>$mod_date</td>
|
||
|
<td><a href=\"edit.php?nr=$post_id\" class=\"btn btn-info\">Edytuj</a></td>
|
||
|
<td><a href=\"usun.php?nr=$post_id\" class=\"btn btn-danger\" onclick=\"javascript:return confirm('Czy na pewno usunąć?'); \">Usuń</a></td>
|
||
|
</tr>";
|
||
|
}
|
||
|
$sql->close();
|
||
|
}
|
||
|
else die( "Błąd w zapytaniu SQL! Sprawdź kod SQL w PhpMyAdmin." );
|
||
|
|
||
|
$mysqli->close();
|
||
|
?>
|
||
|
</table>
|
||
|
<a href="dodaj.php" class="btn btn-success">Dodawanie nowego</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
|
||
|
<!-- Bootstrap Js CDN -->
|
||
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||
|
<!-- jQuery Custom Scroller CDN -->
|
||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.concat.min.js"></script>
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
$(document).ready(function () {
|
||
|
$("#sidebar").mCustomScrollbar({
|
||
|
theme: "minimal"
|
||
|
});
|
||
|
|
||
|
$('#sidebarCollapse').on('click', function () {
|
||
|
$('#sidebar, #content').toggleClass('active');
|
||
|
$('.collapse.in').toggleClass('in');
|
||
|
$('a[aria-expanded=true]').attr('aria-expanded', 'false');
|
||
|
});
|
||
|
|
||
|
$('#dodajemy').click(function(){
|
||
|
$("#zawartosc").load('index.php');
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|