ClaveAudio_Web/admin/edito/imagenes_db.php
2011-05-06 11:33:27 +00:00

45 lines
1.7 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.
$imagen_id=$_REQUEST['imagen_id'];
$imagen_filepath=$_REQUEST['imagen_filepath'];
$imagen_thumbpath=$_REQUEST['imagen_thumbpath'];
$imagen_url=$_REQUEST['imagen_url'];
$imagen_pie=$_REQUEST['imagen_pie'];
$imagen_metadata=$_REQUEST['imagen_metadata'];
$imagen_width=$_REQUEST['imagen_width'];
$imagen_height=$_REQUEST['imagen_height'];
if(db_connect()) {
switch($operacion) {
case "add":
$sql = 'INSERT INTO edito_imagenes(imagen_id, imagen_filepath, imagen_thumbpath, imagen_url, imagen_pie, imagen_metadata, imagen_width, imagen_height) VALUES("' . $imagen_id . '", "' . $imagen_filepath . '", "' . $imagen_thumbpath . '", "' . $imagen_url . '", "' . $imagen_pie . '", "' . $imagen_metadata . '", "' . $imagen_width . '", "' . $imagen_height . '");';
break;
case "edit":
$sql = 'UPDATE edito_imagenes SET imagen_id="' . $imagen_id . '", imagen_filepath="' . $imagen_filepath . '", imagen_thumbpath="' . $imagen_thumbpath . '", imagen_url="' . $imagen_url . '", imagen_pie="' . $imagen_pie . '", imagen_metadata="' . $imagen_metadata . '", imagen_width="' . $imagen_width . '", imagen_height="' . $imagen_height . '" WHERE imagen_id = ' . $_REQUEST['id'];
break;
case "delete":
$sql = 'DELETE FROM edito_imagenes WHERE imagen_id = ' . $_REQUEST['id'];
break;
default:
break;
}
$result = mysql_query($sql) or header('Location: ../error.php');
header('Location: imagenes.php');
}
}
?>