function borraMapa($usuario, $id, $nombre) { //LLAMO A CONSULTAS PARA HACER EL BORRADO EN BBDD include_once dirname(__DIR__) . "/dao/consultas.php"; $registro = damePantallaPorId($id); if ($registro[0]['usuario'] == $usuario && $registro[0]['nombre'] == $nombre) { $resul = borraPantalla($id, $nombre); if ($resul == true) { //Si ha devuelto true el borrado de pantalla, borro la imagen $nombreComp = dirname(__DIR__) . "/../img/mapasUsuarios/{$nombre}.png"; unlink($nombreComp); } else { return "Lo sentimos, hubo un error"; } } else { return "Lo sentimos, hubo un error"; } header('Location: ../vistas/pacmanUsrs.php'); }
if (isset($_GET['mapas']) && htmlspecialchars($_GET['mapas']) == 'usr') { $mapas = '******'; /*if ($handle = opendir('autogenerados')) { while (false !== ($entry = readdir($handle))) { if (substr($entry,-3)==".js"){ $version = $entry; } } closedir($handle); }*/ } else { $mapas = '******'; } if (isset($_GET['id'])) { $nivel = htmlspecialchars($_GET['id']); $pantalla = damePantallaPorId($nivel)[0]; $mapa = $pantalla['pantalla']; $nCol = $pantalla['columnas']; $nFil = $pantalla['filas']; $pantallaId = $pantalla['id']; $mapajs = ""; $caracter = 0; for ($i = 0; $i <= strlen($mapa) - 1; $i++) { //para cada caracter de mapa recibido: if ($i % $nCol == 0) { //si empieza una nueva fila añado vector js $mapajs .= '['; } if ($mapa[$i] == 'x') { $mapajs .= $i % $nCol == $nCol - 1 ? "]," : " ,"; } elseif ($mapa[$i] == 'd' || $mapa[$i] == 'z') {