admin-zone update

This commit is contained in:
Patryk 2018-12-15 14:13:19 +01:00
parent 5523992b27
commit 60a0fe182d
2 changed files with 21 additions and 8 deletions

View File

@ -23,6 +23,16 @@ if(empty($_SESSION['user'])){
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css">
</head>
<body>
<?php
include "../settings/db_connect.php";
$user=$_SESSION['user'];
$password=$_SESSION['password'];
// Getting informations about user's account
$blogdata = mysqli_query($mysqli, "SELECT * FROM user WHERE password='$password' AND username='$user'");
$inforow = mysqli_fetch_array($blogdata);
$user_blog_id = $inforow['user_id'];
$_SESSION['user_blog_id']=$user_blog_id;
?>
<div class="wrapper">
<?php include "sidebar.php"; ?>
<div id="content">
@ -47,9 +57,7 @@ if(empty($_SESSION['user'])){
</tr>
<?php
$trash = '';
$user=$_SESSION['user'];
$password=$_SESSION['password'];
include "../settings/db_connect.php";
//SELECT * FROM post JOIN user ON post.blog_id=user.user_id WHERE user.username='$user' AND user.password='$password' ORDER BY data_dodania
if ($sql = $mysqli->prepare("SELECT * FROM post WHERE blog_id IN (SELECT user_id FROM user WHERE username='$user' AND password='$password') ORDER BY data_dodania"))
{
@ -100,6 +108,5 @@ else die( "Błąd w zapytaniu SQL! Sprawdź kod SQL w PhpMyAdmin. $user $passwor
});
});
</script>
<a href="logout.php">Logout</a>
</body>
</html>

View File

@ -1,13 +1,19 @@
<nav id="sidebar">
<div class="sidebar-header">
<h3>Panel użytkownika</h3>
<h3 style="text-align:center;">Panel użytkownika</h3>
<h4 style="text-align:center;">Witaj <?php echo $_SESSION['user']; ?></h4>
</div>
<ul class="list-unstyled components">
<li><a href="">Strona główna</a></li>
<li><a href="index.php">Strona główna</a></li>
<li class="active"><a target="zawartosc" name="dodajemy" href="index.php">Posty</a></li>
<li><a href="blog.php?user_id=<?php echo $blog_id?>">Blog</a></li>
<li><a href="newsy.php">Newsy</a></li>
<li><a href="account_settings.php">Ustawienia Konta</a></li>
</ul>
<div>
<ul class="list-unstyled components">
<li><a href="../blog-post/blog.php?user_id=<?php echo $_SESSION['user_blog_id']; ?>" style="color:red;">Przejdź do Bloga</a></li>
<li><a href="logout.php">Wyloguj</a> </li>
</ul>
</nav>