Edit files fix
This commit is contained in:
parent
0d0650ce29
commit
1a942279ec
@ -41,11 +41,12 @@ else{
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<form method="post" action="edit_post.php">
|
||||
<form method="post" action="update_post.php">
|
||||
<div class="addPostForm">
|
||||
<?php
|
||||
include "../settings/db_connect.php";
|
||||
$post_id = $_GET['post_id'];
|
||||
$_SESSION['post_id']=$post_id;
|
||||
if ( $sql = $mysqli->prepare( "SELECT tytul,opis,tekst FROM post WHERE post_id= ?;"))
|
||||
{
|
||||
$sql->bind_param("i" ,$post_id);
|
||||
|
25
admin-zone/update_post.php
Normal file
25
admin-zone/update_post.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
if( !isset( $_SESSION ) ) session_start();
|
||||
if(empty($_SESSION['user'])){
|
||||
header('Location: login.php');
|
||||
}
|
||||
else{
|
||||
$user=$_SESSION['user'];
|
||||
$post_id=$_SESSION['post_id'];
|
||||
}
|
||||
include "../settings/db_connect.php";
|
||||
$text=$_POST['post_text'];
|
||||
$meta_desc=$_POST['meta_desc'];
|
||||
$title=$_POST['title'];
|
||||
$mod_date=date("Y-m-d H:i:s");
|
||||
$sql = $mysqli->prepare("UPDATE post SET tytul=?,opis=?,tekst=?,data_modyfikacji=? WHERE post_id=?;");
|
||||
if ($sql)
|
||||
{
|
||||
$sql->bind_param("isssi",$title,$meta_desc,$text,$mod_date,$post_id);
|
||||
$sql->execute();
|
||||
$sql->close();
|
||||
}
|
||||
$mysqli->close();
|
||||
|
||||
//header ("Location: http://localhost/TAS-ALFA/admin-zone/");
|
||||
?>
|
Loading…
Reference in New Issue
Block a user