index.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /*
  3. * Copyright (C) 2021 Echedey López Romero <elr@disroot.org>
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // Mostrar errores en pantalla
  19. ini_set('display_errors', '1');
  20. ini_set('display_startup_errors', '1');
  21. error_reporting(E_ALL);
  22. // Iniciar la reparación de salida con Tidy
  23. ini_set('tidy.clean_output', '1');
  24. // Cargar variables
  25. include './variables.php';
  26. // Cargar functiones
  27. include './functions.php';
  28. if (isset($_REQUEST['operacion'])) {
  29. $Operacion = $_REQUEST['operacion'];
  30. if ($Operacion == 'comprobar') {
  31. $Peticion = $_REQUEST;
  32. for ($Pos = 1; $Pos <= count($Preguntas); $Pos++) {
  33. if (isset($Peticion['respuesta_' . $Pos])) {
  34. $RespuestaGeneralPos = $Peticion['respuesta_' . $Pos];
  35. $Respuestas = $Preguntas[$Pos - 1]['opciones'];
  36. if (array_key_exists($RespuestaGeneralPos, $Respuestas)) {
  37. $RespuestasUsuario['respuesta_' . $Pos] = $RespuestaGeneralPos;
  38. } else {
  39. $RespuestasUsuario['respuesta_' . $Pos] = null;
  40. }
  41. } else {
  42. $RespuestasUsuario['respuesta_' . $Pos] = null;
  43. }
  44. }
  45. $Comprobar = true;
  46. }
  47. }
  48. include './vista.php';