This commit is contained in:
Patryk 2018-12-17 21:50:22 +01:00
commit f4cac0999a
6 changed files with 90 additions and 88 deletions

View File

@ -70,7 +70,7 @@ if ($sql = $mysqli->prepare("SELECT * FROM post WHERE blog_id IN (SELECT user_i
<td><?php echo $post_id;?></td>
<td><?php echo $title; ?></td>
<td><?php echo $description; ?></td>
<td><img style="margin-left:20px;" width="50" height= "50" src="<?php echo $img; ?>"></td>
<td><img style="margin-left:20px;" width="50" height= "50" src="../blog-post/<?php echo $img; ?>"></td>
<td><?php echo $date; ?></td>
<td><?php echo $mod_date; ?></td>
<td><a href="edit.php?post_id=<?php echo $post_id; ?>" class="btn btn-info">Edytuj</a></td>

View File

@ -109,7 +109,7 @@ else die( "Błąd w zapytaniu SQL! Sprawdź kod SQL w PhpMyAdmin." );
$trash = '';
if ($sql = $mysqli->prepare("SELECT * FROM post WHERE blog_id=$user_id ORDER BY data_dodania"))
if ($sql = $mysqli->prepare("SELECT * FROM post WHERE blog_id=$user_id ORDER BY data_dodania DESC"))
{
$checkIfHasPost = $mysqli->query("SELECT * FROM post WHERE blog_id=$user_id");
if ($checkIfHasPost) {
@ -136,7 +136,7 @@ if ($sql = $mysqli->prepare("SELECT * FROM post WHERE blog_id=$user_id ORDER BY
<div class="project">
<div class="photo-wrapper">
<div class="photo foto cover">
<div class="name foto2 cover foto1">
<a href="post.php?post=<?php echo $post_id; ?>"><img class="img-responsive" src="<?php echo $image; ?>" alt="">
<div class="text-block">

View File

@ -8,7 +8,7 @@
<li><a href="#post">Posty</a></a></li>
<li class="divider"></li>
<li><a href="../admin-zone/">Panel Administratora</a></li>
<li><a href="../index.html">Strona główna</a></li>
<li><a href="../index.php">Strona główna</a></li>
</div>
</div>
</div>

View File

@ -51,7 +51,7 @@ $sql->close();
<div class="dropdown-menu" aria-labelledby="dropdownMenu2">
<li><a href="blog.php?user_id=<?php echo $blog_id; ?>">Wróć do bloga</a></li>
<li><a href="../admin-zone/">Panel Administratora</a></li>
<li><a href="../index.html">Strona główna</a></li>
<li><a href="../index.php">Strona główna</a></li>
</div>
</div>
</div>
@ -117,7 +117,7 @@ if ($sql = $mysqli->prepare("SELECT * FROM post WHERE post_id =$post"))
<div class="container">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 name-desc">
<h4><?php echo $date; ?></h4>
</div><br>
</div><br><br>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 name-desc">
@ -139,7 +139,7 @@ else{
<div class="row registerMain">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 name-desc">
<h4><?php echo $date; ?></h4>
</div><br>
</div><br><br>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 name-desc elementsOnRegisterMain">
@ -164,7 +164,7 @@ else{
</div><z>Średnia ocena: <?php echo $averageRating ?> </z>
</div>
</div><br>
</div>
</div>

View File

@ -1,80 +0,0 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<title>Projekt blogowy</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="css/global.css">
<!-- bootstrap js -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</head>
<body class="body">
<header>
<div class="navHeader">
<img src="../images/artist-camera-dslr-22185.jpg" alt="Bloggero - najlepszy serwis blogowy!">
</div>
<div class="row elementsOnHeader">
<div class="col-md-2 login">
<a href="admin-zone/login.php" class="button" role="button">Zarządzaj blogiem</a>
</div>
<div class="col-md-4 register"r>
<h1>Centrum Blogów</h1>
<a href="register/index.php" class="button" role="button">Zacznij swą blogową przygodę</a>
</div>
<div class="col-md-3 search" style="align-item: right">
<input type="text" placeholder="Szukaj">
<input type="submit">
</div>
</div>
</header>
<div class="row mainrow">
<div class="col-md-12"><h2>Najnowsze wpisy:</h2></div>
<div class="col-md-4 mininote">
<h3>Lorem Ipsum</h3>
<a href="http://lipsum.com"><img src="http://placehold.it/200x200"></a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<a href="http://lipsum.com" style="font-size: 10px">Czytaj więcej</a></p>
</div>
<div class="col-md-4 mininote">
<h3>Lorem Ipsum</h3>
<a href="http://lipsum.com"><img src="http://placehold.it/200x200"></a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<a href="http://lipsum.com" style="font-size: 10px">Czytaj więcej</a></p>
</div>
<div class="col-md-4 mininote">
<h3>Lorem Ipsum</h3>
<a href="http://lipsum.com"><img src="http://placehold.it/200x200"></a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<a href="http://lipsum.com" style="font-size: 10px">Czytaj więcej</a></p>
</div>
<div class="col-md-4 mininote">
<h3>Lorem Ipsum</h3>
<a href="http://lipsum.com"><img src="http://placehold.it/200x200"></a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. <a href="http://lipsum.com" style="font-size: 10px">Czytaj więcej</a></p>
</div>
<div class="col-md-4 mininote">
<h3>Lorem Ipsum</h3>
<a href="http://lipsum.com"><img src="http://placehold.it/200x200"></a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<a href="http://lipsum.com" style="font-size: 10px">Czytaj więcej</a></p>
</div>
<div class="col-md-4 mininote">
<h3>Lorem Ipsum</h3>
<a href="http://lipsum.com"><img src="http://placehold.it/200x200"></a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<a href="http://lipsum.com" style="font-size: 10px">Czytaj więcej</a></p>
</div>
</div>
<div class="row footer">
<div class="col-md-12">
<p>Grupa Alfa 2018</p>
</div>
</div>
</div>
</body>
</html>

82
index.php Normal file
View File

@ -0,0 +1,82 @@
<?php if( !isset( $_SESSION ) ) session_start();
?>
<!DOCTYPE html>
<html lang="pl">
<head>
<title>Projekt blogowy</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="css/global.css">
<link href="blog-post/css/style.css" rel="stylesheet">
<!-- bootstrap js -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</head>
<body class="body">
<?php
include "settings/db_connect.php";?>
<header>
<div class="navHeader">
<img src="./images/artist-camera-dslr-22185.jpg" alt="Bloggero - najlepszy serwis blogowy!">
</div>
<div class="row elementsOnHeader">
<div class="col-md-2 login">
<?php if(empty($_SESSION['user'])){ ?> <a href="admin-zone/login.php" class="button" role="button">Zarządzaj blogiem</a><?php }
else { $user=$_SESSION['user']; ?>
<a href="admin-zone/index.php" class="button" role="button">Zarządzaj blogiem</a> <?php } ?>
</div>
<div class="col-md-4 register"r>
<h1>Centrum Blogów</h1>
<a href="register/index.php" class="button" role="button">Zacznij swą blogową przygodę</a>
</div>
</div>
</header>
<div class="col-md-12 col-lg-12 "><h2>Najnowsze wpisy:</h2></div>
<div id="postwrap">
<div class="container">
<div class="row">
<?php $trash = '';
if ($sql = $mysqli->prepare("SELECT * FROM post ORDER BY data_dodania DESC"))
{
$sql->execute();
$sql->bind_result($post_id,$trash,$title,$description,$main,$image,$date,$mod_date);
while ($sql->fetch())
{ ?>
<div class="col-lg-4 col-md-6 col-sm-6 col-xs-12 desc">
<div class="project">
<div class="photo-wrapper">
<div class="name foto2 cover foto1">
<a href="blog-post/post.php?post=<?php echo $post_id; ?>"><img class="img-responsive" src="blog-post/<?php echo $image; ?>" alt="">
<div class="text-block">
<p1><?php echo $date; ?></p1>
</div>
</div>
</div>
</div> <h1> <?php echo $title; ?></h1></a>
</div>
<?php }
$sql->close();
}
else die( "Błąd w zapytaniu SQL! Sprawdź kod SQL w PhpMyAdmin." );?>
</div> </div> </div>
<div class="row footer">
<div class="col-md-12">
<p>Grupa Alfa 2018</p>
</div>
</div>
</div>
</body>
</html>