Admin Zone Post adding fix
This commit is contained in:
parent
bacba93d39
commit
5143fab182
@ -49,9 +49,7 @@ else{
|
||||
<div id="aboutdown"></div>
|
||||
</div>
|
||||
</div>
|
||||
<<<<<<< HEAD
|
||||
</div>
|
||||
</nav>
|
||||
</nav>
|
||||
<form method="post" action="insert.php" ENCTYPE="multipart/form-data">
|
||||
<div class="addPostForm">
|
||||
<input type="text" name="title" size="120">
|
||||
@ -66,24 +64,6 @@ else{
|
||||
</div>
|
||||
</form>
|
||||
|
||||
=======
|
||||
</nav>
|
||||
<div class="flex-row">
|
||||
<div class="flex-column">
|
||||
<form class="form" method="post" action="insert.php">
|
||||
<div class="addPostForm">
|
||||
<p>Tytuł</p>
|
||||
<input type="text" class="form-control" name="title" size="120">
|
||||
<p>Meta opis</p>
|
||||
<input type="text" class="form-control" name="meta_desc" size="120">
|
||||
<p>Treść posta</p>
|
||||
<textarea name="post_text" id="editor1" rows="10" cols="80"></textarea>
|
||||
<input type="submit" class="btn btn-success" value="Dodaj post">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
>>>>>>> 4f6ead08b2af1624982230710450d3bc3d9daf92
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -12,5 +12,5 @@ if ($sql = $mysqli->prepare( "DELETE FROM post WHERE post_id= ?;" ))
|
||||
$sql->close();
|
||||
}
|
||||
$mysqli->close();
|
||||
header ("Location: http://localhost/TAS-ALFA/admin-zone/" );
|
||||
header ("Location: index.php" );
|
||||
?>
|
@ -1,22 +1,19 @@
|
||||
<?php
|
||||
if( !isset( $_SESSION ) ) session_start();
|
||||
if(empty($_SESSION['user'])){
|
||||
header('Location: ./login.php');
|
||||
}
|
||||
if( !isset( $_SESSION ) ) session_start();
|
||||
if(empty($_SESSION['user'])){
|
||||
header('Location: ./login.php');
|
||||
}
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!-- SEO FRIENDLY ZONE -->
|
||||
<title>Panel CMS - Bloggero</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="robots" content="noindex,nofollow" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- END OF SEO FRIENDLY ZONE -->
|
||||
<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">
|
||||
|
||||
|
||||
<<<<<<< HEAD
|
||||
<!-- 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">
|
||||
@ -83,96 +80,14 @@ if ($sql = $mysqli->prepare("SELECT * FROM post WHERE blog_id IN (SELECT user_i
|
||||
$sql->close();
|
||||
}
|
||||
else die( "Błąd w zapytaniu SQL! Sprawdź kod SQL w PhpMyAdmin. $user $password" );
|
||||
=======
|
||||
<!-- 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="Shortcut icon" href="../blog-post/img/name-label.png"/>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css">
|
||||
<!-- END OF JS STYLE AND BS -->
|
||||
|
||||
<!-- BOOTSTRAP SCRIPT LOADER -->
|
||||
<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>
|
||||
<!-- END OF BOOTSTRAP SCRIPT LOADER -->
|
||||
>>>>>>> 4f6ead08b2af1624982230710450d3bc3d9daf92
|
||||
|
||||
</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" class="container-fluid">
|
||||
<nav class="navbar navbar-default">
|
||||
<div class="flex-row">
|
||||
<div class="navbar-header flex-column">
|
||||
<button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
|
||||
<i class="glyphicon glyphicon-align-left"></i>
|
||||
<span>Toggle Sidebar</span>
|
||||
</button>
|
||||
<?php //include "menu.php" ?>
|
||||
<!-- <div id="aboutdown"></div> -->
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="flex-row">
|
||||
<div class="flex-column">
|
||||
<table class="table table-striped" style="margin-left:10px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID Postu</th>
|
||||
<th>Tytuł</th>
|
||||
<th>Meta Description</th>
|
||||
<th>Data dodania</th>
|
||||
<th>Data modyfikacji</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
$trash = '';
|
||||
|
||||
//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"))
|
||||
{
|
||||
$sql->execute();
|
||||
$sql->bind_result($post_id,$trash,$title,$description,$main,$img,$date,$mod_date);
|
||||
while ($sql->fetch())
|
||||
{
|
||||
echo "<tr>
|
||||
<td>$post_id</td>
|
||||
<td>$title</td>
|
||||
<td>$description</td>
|
||||
<td>$date</td>
|
||||
<td>$mod_date</td>
|
||||
<td><a href=\"edit.php?post_id=$post_id\" class=\"btn btn-info\">Edytuj</a></td>
|
||||
<td><a href=\"delete_post.php?post_id=$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. $user $password" );
|
||||
|
||||
$mysqli->close();
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<a href="add_post.php" style="margin-left:10px;" class="btn btn-success">Dodawanie nowego</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
|
||||
$mysqli->close();
|
||||
?>
|
||||
</table>
|
||||
<a href="add_post.php" style="margin-left:10px;" 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 -->
|
||||
@ -192,8 +107,8 @@ else die( "Błąd w zapytaniu SQL! Sprawdź kod SQL w PhpMyAdmin. $user $passwor
|
||||
|
||||
$('#dodajemy').click(function(){
|
||||
$("#zawartosc").load('index.php');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user