-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditar_noticia.php
29 lines (27 loc) · 1002 Bytes
/
editar_noticia.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php // editar.php
/*
* Página para editar noticias
* @author Daniel (Nasty35)
*/
require 'core/brain.php'; // Núcleo del CMS
if(!Logued) { // Comprobamos si no está logado, y si no lo está lo llevamos al index.php
header('Location: index.php');
} else {
if(isset($_POST['id'])) {
$id = $_POST['id'];
$titulo = $_POST['titulo'];
$autor = $_POST['autor'];
$categoria = $_POST['categoria'];
$noticia = $_POST['noticia'];
if(Users::getInfoForName($autor, 'id') == Users::getInfoForName($_SESSION['username'], 'id')) { // Comprobamos que sea el dueño de la noticia
Noticias::editar($id, $titulo, $autor, $categoria, $noticia);
header('location: comentarios.php?id=' . $_POST['id']);
} else {
header('location: comentarios.php?id=' . $_POST['id']);
}
} else {
$tpl->setHeader('Editar noticia', 'noticias.php');
$tpl->add('editar-body');
}
}
?>