Current Path : /home/baheco/public_html/adm/clases/controlador/slider/ |
Linux sd-1582531-l.dattaweb.com 3.10.0-1160.118.1.el7.x86_64 #1 SMP Wed Apr 24 16:01:50 UTC 2024 x86_64 |
Current File : /home/baheco/public_html/adm/clases/controlador/slider/controlador-editar.php |
<?php if (isset($_POST['id'])&&isset($_POST['orden'])) { include_once(dirname(dirname(dirname(__FILE__))).'/modelo/slider.php'); include_once(dirname(dirname(dirname(__FILE__))).'/datos/datos-slider.php'); if (file_exists($_FILES['imagen']['tmp_name']) || is_uploaded_file($_FILES['imagen']['tmp_name'])) { if(move_uploaded_file($_FILES['imagen']['tmp_name'],dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/img/'.$_FILES['imagen']['name'])) { $slider = new Slider(); $sliderDatos = new DatosSlider(); $slider->setId($_POST["id"]); $slider->setOrden($_POST["orden"]); $slider->setTexto($_POST["titulo"]); $slider->setImagen($_FILES['imagen']['name']); unlink(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/img/'.$_POST['imagen-vieja']); $sliderDatos->editarNuevoSlider($slider); } else { header('Location: ../../../admin.php?seccion=editar-slider&id='.$_POST["id"].'&operacion=incorrecto'); } } else { $slider = new Slider(); $sliderDatos = new DatosSlider(); $slider->setId($_POST["id"]); $slider->setOrden($_POST["orden"]); $slider->setTexto($_POST["titulo"]); $sliderDatos->editarSlider($slider); } header('Location: ../../../admin.php?seccion=editar-slider&id='.$_POST["id"].'&operacion=correcto'); } else { header('Location: ../../../admin.php?seccion=editar-slider&id='.$_POST["id"].'&operacion=incorrecto'); } ?>