2011-05-30 17:04:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// this file has been generated by sformi, the clever tool for lazy developers.
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
session_start();
|
|
|
|
|
if (!session_is_registered("clave_audio")) {
|
|
|
|
|
include("../login.php");
|
|
|
|
|
if (!$continuar) exit;
|
|
|
|
|
}
|
|
|
|
|
include('../db.php');
|
|
|
|
|
include('upload.php');
|
|
|
|
|
|
|
|
|
|
if(isset($_REQUEST['op'])){
|
|
|
|
|
$operacion = $_REQUEST['op'];
|
|
|
|
|
|
|
|
|
|
// here I read the variables passed by the calling page.
|
|
|
|
|
$id = $_REQUEST['id'];
|
|
|
|
|
$oferta_categoria=$_REQUEST['oferta_categoria'];
|
|
|
|
|
$oferta_nombre=$_REQUEST['oferta_nombre'];
|
|
|
|
|
$oferta_descripcion=$_REQUEST['oferta_descripcion'];
|
|
|
|
|
$oferta_estado=$_REQUEST['oferta_estado'];
|
|
|
|
|
$oferta_pvp=$_REQUEST['oferta_pvp'];
|
|
|
|
|
$oferta_fab_id=$_REQUEST['oferta_fab_id'];
|
|
|
|
|
$oferta_unidades=$_REQUEST['oferta_unidades'];
|
|
|
|
|
|
|
|
|
|
$conn = db_connect();
|
|
|
|
|
if($conn) {
|
|
|
|
|
switch($operacion) {
|
|
|
|
|
case "add":
|
|
|
|
|
$sql = 'INSERT INTO shoop_oferta(oferta_categoria, oferta_nombre, oferta_descripcion, oferta_estado, oferta_pvp, oferta_fab_id, oferta_unidades) VALUES("' . $oferta_categoria . '", "' . $oferta_nombre . '", "' . $oferta_descripcion . '", "' . $oferta_estado . '", "' . $oferta_pvp . '", "' . $oferta_fab_id . '", "' . $oferta_unidades . '");';
|
|
|
|
|
$result = mysql_query($sql, $conn) or header('Location: ../error.php');
|
|
|
|
|
$id = mysql_insert_id($conn);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "edit":
|
|
|
|
|
$sql = 'UPDATE shoop_oferta SET oferta_categoria="' . $oferta_categoria . '", oferta_nombre="' . $oferta_nombre . '", oferta_descripcion="' . $oferta_descripcion . '", oferta_estado="' . $oferta_estado . '", oferta_pvp="' . $oferta_pvp . '", oferta_fab_id="' . $oferta_fab_id . '", oferta_unidades="' . $oferta_unidades . '" WHERE oferta_id = ' . $id;
|
|
|
|
|
$result = mysql_query($sql, $conn) or header('Location: ../error.php');
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "del":
|
|
|
|
|
$sql = 'DELETE FROM shoop_oferta WHERE oferta_id = ' . $id;
|
|
|
|
|
$result = mysql_query($sql, $conn) or header('Location: ../error.php');
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($operacion != "del") {
|
|
|
|
|
// modifico la imagen.
|
|
|
|
|
uploadImagenOferta($id, 247, 95, 168, 102);
|
2011-06-15 08:43:54 +00:00
|
|
|
uploadPDFOferta($id);
|
2011-05-30 17:04:37 +00:00
|
|
|
// y vuelvo a la pantalla correspondiente
|
|
|
|
|
header('Location: oferta_edit.php?op=edit&id=' . $id);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
header('Location: oferta.php');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|