From ec0a391745e0ad1273ffe8465e902d0714f1421b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mu=C3=B1oz=20Garcia?= <73303506+danimu03@users.noreply.github.com> Date: Tue, 8 Jun 2021 13:45:44 +0200 Subject: [PATCH] debug forms --- panel_admin/includes/formAddCinema.php | 4 +-- panel_admin/includes/formAddFilm.php | 4 +-- panel_admin/includes/formAddManager.php | 4 +-- panel_admin/includes/formAddPromotion.php | 4 +-- panel_admin/includes/formDeleteCinema.php | 4 +-- panel_admin/includes/formDeleteFilm.php | 4 +-- panel_admin/includes/formDeleteManager.php | 4 +-- panel_admin/includes/formDeletePromotion.php | 4 +-- panel_admin/includes/formEditCinema.php | 4 +-- panel_admin/includes/formEditFilm.php | 6 ++-- panel_admin/includes/formEditManager.php | 4 +-- panel_admin/includes/formEditPromotion.php | 6 ++-- panel_admin/index.php | 32 +++++++++----------- 13 files changed, 40 insertions(+), 44 deletions(-) diff --git a/panel_admin/includes/formAddCinema.php b/panel_admin/includes/formAddCinema.php index 65620aa..116b97b 100644 --- a/panel_admin/includes/formAddCinema.php +++ b/panel_admin/includes/formAddCinema.php @@ -8,7 +8,7 @@ include_once('../assets/php/form.php'); class formAddCinema extends Form{ public function __construct(){ - $op = array("action"=>"./?state=mc"); + $op = array("action"=>"./?state=mc&option=a"); parent::__construct('formAddCinema',$op); } @@ -77,7 +77,7 @@ class formAddCinema extends Form{
"; - //$result = './?state=mc'; + $result = './?state=mc'; } $exist->free(); } diff --git a/panel_admin/includes/formAddFilm.php b/panel_admin/includes/formAddFilm.php index cc2ac35..58ed7ba 100644 --- a/panel_admin/includes/formAddFilm.php +++ b/panel_admin/includes/formAddFilm.php @@ -11,7 +11,7 @@ class formAddFilm extends Form{ const EXTENSIONS = array('gif','jpg','jpe','jpeg','png'); public function __construct() { - $options = array("action" => "./?state=mf", 'enctype' => 'multipart/form-data'); + $options = array("action" => "./?state=mf&option=a", 'enctype' => 'multipart/form-data'); parent::__construct('formAddFilm', $options); } @@ -126,7 +126,7 @@ class formAddFilm extends Form{ "; - //$result = './?state=mf'; + $result = './?state=mf'; }else { $result['img'] = 'El archivo tiene un nombre o tipo no soportado'; diff --git a/panel_admin/includes/formAddManager.php b/panel_admin/includes/formAddManager.php index 10a942f..7de47df 100644 --- a/panel_admin/includes/formAddManager.php +++ b/panel_admin/includes/formAddManager.php @@ -12,7 +12,7 @@ class formAddManager extends Form{ const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$'; public function __construct() { - $options = array("action" => "./?state=mg"); + $options = array("action" => "./?state=mg&option=a"); parent::__construct('formAddManager', $options); } @@ -78,7 +78,7 @@ class formAddManager extends Form{ "; - //$result = './?state=mg'; + $result = './?state=mg'; } $exist->free(); diff --git a/panel_admin/includes/formAddPromotion.php b/panel_admin/includes/formAddPromotion.php index 97916b4..b971750 100644 --- a/panel_admin/includes/formAddPromotion.php +++ b/panel_admin/includes/formAddPromotion.php @@ -11,7 +11,7 @@ class formAddPromotion extends Form{ const EXTENSIONS = array('gif','jpg','jpe','jpeg','png'); public function __construct() { - $options = array("action" => "./?state=mp", 'enctype' => 'multipart/form-data'); + $options = array("action" => "./?state=mp&option=a", 'enctype' => 'multipart/form-data'); parent::__construct('formAddPromotion', $options); } @@ -134,7 +134,7 @@ class formAddPromotion extends Form{ "; - //$result = './?state=mp'; + $result = './?state=mp'; }else { $result['img'] = 'El archivo tiene un nombre o tipo no soportado'; diff --git a/panel_admin/includes/formDeleteCinema.php b/panel_admin/includes/formDeleteCinema.php index a861176..e2405bf 100644 --- a/panel_admin/includes/formDeleteCinema.php +++ b/panel_admin/includes/formDeleteCinema.php @@ -8,7 +8,7 @@ include_once('../assets/php/form.php'); class formDeleteCinema extends Form{ public function __construct(){ - $op = array("action"=>"./?state=mc"); + $op = array("action"=>"./?state=mc&option=d"); parent::__construct('formAddCinema',$op); } @@ -59,7 +59,7 @@ class formDeleteCinema extends Form{ "; - //$result = './?state=mc'; + $result = './?state=mc'; } $exist->free(); } diff --git a/panel_admin/includes/formDeleteFilm.php b/panel_admin/includes/formDeleteFilm.php index 8bc90aa..b5dd2c5 100644 --- a/panel_admin/includes/formDeleteFilm.php +++ b/panel_admin/includes/formDeleteFilm.php @@ -10,7 +10,7 @@ class formDeleteFilm extends Form{ const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$'; public function __construct() { - $options = array("action" => "./?state=mf"); + $options = array("action" => "./?state=mf&option=d"); parent::__construct('formDeleteFilm', $options); } @@ -69,7 +69,7 @@ class formDeleteFilm extends Form{ "; - //$result = './?state=mf'; + $result = './?state=mf'; } else{ $result[] = "La pelicula seleccionada no existe."; diff --git a/panel_admin/includes/formDeleteManager.php b/panel_admin/includes/formDeleteManager.php index fd0e3a8..3d5e920 100644 --- a/panel_admin/includes/formDeleteManager.php +++ b/panel_admin/includes/formDeleteManager.php @@ -10,7 +10,7 @@ class formDeleteManager extends Form{ const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$'; public function __construct() { - $options = array("action" => "./?state=mg"); + $options = array("action" => "./?state=mg&option=d"); parent::__construct('formDeleteManager', $options); } @@ -64,7 +64,7 @@ class formDeleteManager extends Form{ "; - //$result = './?state=mg'; + $result = './?state=mg'; } else{ $result[] = "ERROR. No existe un manager con ese ID"; diff --git a/panel_admin/includes/formDeletePromotion.php b/panel_admin/includes/formDeletePromotion.php index 3e07dda..8ab2fd2 100644 --- a/panel_admin/includes/formDeletePromotion.php +++ b/panel_admin/includes/formDeletePromotion.php @@ -10,7 +10,7 @@ class formDeletePromotion extends Form{ public function __construct() { - $op = array("action" => "./?state=mp"); + $op = array("action" => "./?state=mp&option=d"); parent::__construct('formEditPromotion', $op); } @@ -73,7 +73,7 @@ class formDeletePromotion extends Form{ "; - //$result = './?state=mp'; + $result = './?state=mp'; } else{ diff --git a/panel_admin/includes/formEditCinema.php b/panel_admin/includes/formEditCinema.php index 8e66d8a..4d61c39 100644 --- a/panel_admin/includes/formEditCinema.php +++ b/panel_admin/includes/formEditCinema.php @@ -8,7 +8,7 @@ include_once('../assets/php/form.php'); class formEditCinema extends Form{ public function __construct(){ - $op = array("action"=>"./?state=mc"); + $op = array("action"=>"./?state=mc&option=e"); parent::__construct('formAddCinema',$op); } @@ -83,7 +83,7 @@ class formEditCinema extends Form{ "; - //$result = './?state=mc'; + $result = './?state=mc'; } else{ $result[] = "El cine seleccionado no existe."; diff --git a/panel_admin/includes/formEditFilm.php b/panel_admin/includes/formEditFilm.php index b9ba5e2..217d0ca 100644 --- a/panel_admin/includes/formEditFilm.php +++ b/panel_admin/includes/formEditFilm.php @@ -12,7 +12,7 @@ class formEditFilm extends Form{ const EXTENSIONS = array('gif','jpg','jpe','jpeg','png'); public function __construct() { - $options = array("action" => "./?state=mf", 'enctype' => 'multipart/form-data'); + $options = array("action" => "./?state=mf&option=e", 'enctype' => 'multipart/form-data'); parent::__construct('formEditFilm', $options); } @@ -137,7 +137,7 @@ class formEditFilm extends Form{ "; - //$result = './?state=mf'; + $result = './?state=mf'; }else { $result['img'] = 'El archivo tiene un nombre o tipo no soportado'; @@ -156,7 +156,7 @@ class formEditFilm extends Form{ "; - //$result = './?state=mf'; + $result = './?state=mf'; } } diff --git a/panel_admin/includes/formEditManager.php b/panel_admin/includes/formEditManager.php index 8e76a38..2de81b7 100644 --- a/panel_admin/includes/formEditManager.php +++ b/panel_admin/includes/formEditManager.php @@ -11,7 +11,7 @@ class formEditManager extends Form{ const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$'; public function __construct() { - $options = array("action" => "./?state=mg"); + $options = array("action" => "./?state=mg&option=e"); parent::__construct('formEditManager', $options); } @@ -69,7 +69,7 @@ class formEditManager extends Form{ "; - // $result = './?state=mg'; + $result = './?state=mg'; } else{ diff --git a/panel_admin/includes/formEditPromotion.php b/panel_admin/includes/formEditPromotion.php index ad99dee..1a08e4c 100644 --- a/panel_admin/includes/formEditPromotion.php +++ b/panel_admin/includes/formEditPromotion.php @@ -12,7 +12,7 @@ class formEditPromotion extends Form{ const EXTENSIONS = array('gif','jpg','jpe','jpeg','png'); public function __construct() { - $options = array("action" => "./?state=mp", 'enctype' => 'multipart/form-data'); + $options = array("action" => "./?state=mp&option=e", 'enctype' => 'multipart/form-data'); parent::__construct('formEditPromotion', $options); } @@ -139,7 +139,7 @@ class formEditPromotion extends Form{ "; - //$result = './?state=mp'; + $result = './?state=mp'; }else { $result['img'] = 'El archivo tiene un nombre o tipo no soportado'; @@ -158,7 +158,7 @@ class formEditPromotion extends Form{ "; - //$result = './?state=mp'; + $result = './?state=mp'; } } else{ diff --git a/panel_admin/index.php b/panel_admin/index.php index 5b388e7..2ffeb32 100644 --- a/panel_admin/index.php +++ b/panel_admin/index.php @@ -9,10 +9,10 @@ if(!isset($_GET["state"])) $_GET["state"] =null; switch($_GET["state"]){ - case 'mc': if(isset($_POST['edit_cinema'])) { + case 'mc': if(isset($_POST['edit_cinema']) || (isset($_GET['option']) && ($_GET['option'] == 'e'))) { $reply=AdminPanel::editCinema(); } - else if(isset($_POST['delete_cinema'])) { + else if(isset($_POST['delete_cinema']) || (isset($_GET['option']) && ($_GET['option'] == 'd'))) { $reply=AdminPanel::deleteCinema(); } else { @@ -26,46 +26,42 @@ } } } - else { + else if(!isset($_GET['option']) || ($_GET['option'] == 'a')) { $reply=AdminPanel::addCinema(); $reply.= ($template->print_cinemas()); - } - }; - break; - case 'mf': if(isset($_POST['edit_film'])) { + }}; break; + case 'mf': if(isset($_POST['edit_film']) || (isset($_GET['option']) && ($_GET['option'] == 'e'))) { $reply=AdminPanel::editFilm(); } - else if(isset($_POST['delete_film'])) { + else if(isset($_POST['delete_film']) || (isset($_GET['option']) && ($_GET['option'] == 'd'))) { $reply=AdminPanel::deleteFilm(); } - else { + else if(!isset($_GET['option']) || ($_GET['option'] == 'a')) { $reply=AdminPanel::addFilm(); $reply.= $template->print_fimls(); - }; + }; break; case 'mp': - if(isset($_POST['edit_promotion'])) { + if(isset($_POST['edit_promotion']) || (isset($_GET['option']) && ($_GET['option'] == 'e'))) { $reply=AdminPanel::editPromotion(); } - else if(isset($_POST['delete_promotion'])) { + else if(isset($_POST['delete_promotion']) || (isset($_GET['option']) && ($_GET['option'] == 'd'))) { $reply=AdminPanel::deletePromotion(); } - else { + else if(!isset($_GET['option']) || ($_GET['option'] == 'a')) { $reply=AdminPanel::addPromotion(); $reply.=AdminPanel::print_promotions(); - }; break; - case 'mg': if(isset($_POST['edit_manager'])) { + case 'mg': if(isset($_POST['edit_manager']) || (isset($_GET['option']) && ($_GET['option'] == 'e'))) { $reply=AdminPanel::editManager(); } - else if(isset($_POST['delete_manager'])) { + else if(isset($_POST['delete_manager']) || (isset($_GET['option']) && ($_GET['option'] == 'd'))) { $reply=AdminPanel::deleteManager(); } - else if(isset($_POST['add_manager'])) { + else if(isset($_POST['add_manager']) || (isset($_GET['option']) && ($_GET['option'] == 'a'))) { $reply=AdminPanel::addManager(); } - else { $reply=AdminPanel::print_managers(); $reply.=AdminPanel::showAddBotton();