git-svn-id: https://192.168.0.254/svn/Proyectos.ClaveAudio_Web/trunk@2 44ade383-bb54-5b4f-835b-923f7702b206
42 lines
1.6 KiB
PHP
42 lines
1.6 KiB
PHP
<?php
|
|
session_start();
|
|
include('../db.php');
|
|
|
|
if (!session_is_registered("clave_audio")) {
|
|
include("../login.php");
|
|
if (!$continuar) exit;
|
|
}
|
|
|
|
if(isset($_REQUEST['op'])){
|
|
$operacion = $_REQUEST['op'];
|
|
|
|
// here I read the variables passed by the calling page.
|
|
$comentario_articulo_id=$_REQUEST['comentario_articulo_id'];
|
|
$comentario_autor_id=$_REQUEST['comentario_autor_id'];
|
|
$comentario_autor_name=$_REQUEST['comentario_autor_name'];
|
|
$comentario_texto=$_REQUEST['comentario_texto'];
|
|
$comentario_fecha=$_REQUEST['comentario_fecha'];
|
|
|
|
|
|
if(db_connect()) {
|
|
switch($operacion) {
|
|
case "add":
|
|
$sql = 'INSERT INTO edito_comentarios(comentario_articulo_id, comentario_autor_id, comentario_autor_name, comentario_texto, comentario_fecha) VALUES("' . $comentario_articulo_id . '", "' . $comentario_autor_id . '", "' . $comentario_autor_name . '", "' . $comentario_texto . '", "' . $comentario_fecha . '");';
|
|
break;
|
|
|
|
case "edit":
|
|
$sql = 'UPDATE edito_comentarios SET comentario_articulo_id="' . $comentario_articulo_id . '", comentario_autor_id="' . $comentario_autor_id . '", comentario_autor_name="' . $comentario_autor_name . '", comentario_texto="' . $comentario_texto . '", comentario_fecha="' . $comentario_fecha . '" WHERE comentario_articulo_id = ' . $_REQUEST['id'];
|
|
break;
|
|
|
|
case "delete":
|
|
$sql = 'DELETE FROM edito_comentarios WHERE comentario_articulo_id = ' . $_REQUEST['id'];
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
$result = mysql_query($sql) or header('Location: ../error.php');
|
|
header('Location: comentarios.php');
|
|
}
|
|
}
|
|
?>
|