[39a8a99] | 1 | <?php |
---|
| 2 | // ***************************************************************************** |
---|
[e7bfe29] | 3 | // Aplicación WEB: ogAdmWebCon |
---|
| 4 | // Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla |
---|
| 5 | // Fecha Creación: Agosto-2010 |
---|
[39a8a99] | 6 | // Nombre del fichero: acceso.php |
---|
[e7bfe29] | 7 | // Descripción: Pantalla principal de acceso a la consola de administración web. |
---|
| 8 | // Versión 1.0.3: Unificación de ficheros e internacionalización. |
---|
| 9 | // Autor: Ramón Gómez - ETSII, Universidad de Sevilla |
---|
[39a8a99] | 10 | // Fecha: 2012-02-07 |
---|
| 11 | // ***************************************************************************** |
---|
[1664a97] | 12 | session_start(); |
---|
[e7bfe29] | 13 | if(isset($_SESSION)){ // Si existe algua sesión ... |
---|
[39a8a99] | 14 | session_unset(); // Elimina variables |
---|
[3806a31] | 15 | session_destroy(); // Destruye sesi�n |
---|
[39a8a99] | 16 | } |
---|
| 17 | |
---|
[e7bfe29] | 18 | // Cargar configuración. |
---|
[39a8a99] | 19 | include_once("controlacceso.php"); |
---|
| 20 | include_once("./includes/CreaComando.php"); |
---|
| 21 | include_once("./clases/AdoPhp.php"); |
---|
| 22 | include_once("./includes/HTMLSELECT.php"); |
---|
| 23 | |
---|
[ea4319c] | 24 | // Control de errores. |
---|
[39a8a99] | 25 | if (isset($_GET["herror"])) $herror=$_GET["herror"]; |
---|
| 26 | if (isset($_POST["herror"])) $herror=$_POST["herror"]; |
---|
| 27 | // Idioma. |
---|
[bdf6991] | 28 | if (isset($_POST["nemonico"])) $parmidi=$_POST["nemonico"]; |
---|
[ea4319c] | 29 | if (!empty ($parmidi) and file_exists ("idiomas/php/$parmidi/acceso_$parmidi.php")) { |
---|
| 30 | $idi=$parmidi; |
---|
| 31 | } |
---|
[39a8a99] | 32 | include ("idiomas/php/$idi/acceso_$idi.php"); |
---|
| 33 | |
---|
[1a2fa9d8] | 34 | $busidcentro=""; |
---|
[39a8a99] | 35 | $cmd=CreaComando($cnx); // Crea objeto comando |
---|
| 36 | if (!$cmd) |
---|
| 37 | die($TbMsg["ACCESS_ERROR"]); |
---|
| 38 | |
---|
[1a2fa9d8] | 39 | $rs=new Recordset; |
---|
[e2b3904] | 40 | $cmd->texto="SELECT * FROM centros"; |
---|
[1a2fa9d8] | 41 | $rs->Comando=&$cmd; |
---|
| 42 | if (!$rs->Abrir()) return(false); // Error al abrir recordset |
---|
| 43 | $rs->Primero(); |
---|
| 44 | if (!$rs->EOF){ |
---|
| 45 | $busidcentro=$rs->campos["identidad"]; |
---|
| 46 | }$rs->Cerrar(); |
---|
| 47 | |
---|
| 48 | // Valores por defecto. |
---|
| 49 | $herror=0; |
---|
| 50 | if (empty($busidcentro)){ |
---|
| 51 | $idcentro=""; |
---|
| 52 | }else{ |
---|
| 53 | $idcentro=$busidcentro; |
---|
| 54 | } |
---|
[39a8a99] | 55 | ?> |
---|
| 56 | <html> |
---|
| 57 | <head> |
---|
[20885b5] | 58 | <title><?php echo $TbMsg["ACCESS_TITLE"];?></title> |
---|
| 59 | <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> |
---|
| 60 | <link rel="shortcut icon" href="images/iconos/logocirculos.png" type="image/png" /> |
---|
| 61 | <link rel="stylesheet" type="text/css" href="estilos.css" /> |
---|
[39a8a99] | 62 | <script language="javascript"> |
---|
| 63 | //______________________________________________________________________________ |
---|
| 64 | function confirmar(){ |
---|
| 65 | if (comprobar_datos()) |
---|
| 66 | document.fdatos.submit(); |
---|
| 67 | } |
---|
| 68 | //______________________________________________________________________________ |
---|
| 69 | function comprobar_datos(){ |
---|
| 70 | if (document.fdatos.usu.value==""){ |
---|
| 71 | <?php echo 'alert("'.$TbMsg["ACCESS_NOUSER"].'");' ?> |
---|
[3806a31] | 72 | document.fdatos.usu.focus(); |
---|
[39a8a99] | 73 | return(false) |
---|
| 74 | } |
---|
| 75 | if (document.fdatos.pss.value==""){ |
---|
| 76 | <?php echo 'alert("'.$TbMsg["ACCESS_NOPASS"].'");' ?> |
---|
[3806a31] | 77 | document.fdatos.pss.focus(); |
---|
[39a8a99] | 78 | return(false) |
---|
| 79 | } |
---|
[3806a31] | 80 | var p=document.fdatos.idcentro.selectedIndex; |
---|
[39a8a99] | 81 | if (p==0){ |
---|
| 82 | <?php echo 'var res=confirm("'.$TbMsg["ACCESS_NOUNIT"].'");' ?> |
---|
| 83 | if(!res) |
---|
| 84 | return(false) |
---|
| 85 | } |
---|
| 86 | return(true) |
---|
| 87 | } |
---|
| 88 | //______________________________________________________________________________ |
---|
| 89 | function PulsaEnter(oEvento){ |
---|
| 90 | var iAscii; |
---|
| 91 | if (oEvento.keyCode) |
---|
| 92 | iAscii = oEvento.keyCode; |
---|
| 93 | else{ |
---|
| 94 | if (oEvento.which) |
---|
| 95 | iAscii = oEvento.which; |
---|
| 96 | else |
---|
| 97 | return false; |
---|
| 98 | } |
---|
| 99 | if (iAscii == 13) confirmar(); |
---|
| 100 | return true; |
---|
| 101 | } |
---|
| 102 | //______________________________________________________________________________ |
---|
| 103 | </script> |
---|
| 104 | </head> |
---|
| 105 | |
---|
| 106 | <body> |
---|
| 107 | <div class="acceso"> |
---|
| 108 | <h1> <?php echo $TbMsg["ACCESS_HEADING"]; ?> </h1> |
---|
| 109 | <h2> <?php echo $TbMsg["ACCESS_SUBHEAD"]; ?> </h2> |
---|
| 110 | <form action="controlpostacceso.php" name="fdatos" method="post"> |
---|
| 111 | <fieldset> |
---|
[e2b3904] | 112 | <div><label for="usu"><?php echo $TbMsg["ACCESS_USERNAME"]; ?></label> |
---|
| 113 | <input name="usu" type="text" onkeypress="PulsaEnter(event)" /></div> |
---|
| 114 | <div><label for="pss"><?php echo $TbMsg["ACCESS_PASSWORD"]; ?></label> |
---|
| 115 | <input name="pss" type="password" onkeypress="PulsaEnter(event)" /></div> |
---|
| 116 | <div><label for="idcentro"><?php echo $TbMsg["ACCESS_ORGUNIT"]; ?></label> |
---|
| 117 | <?php echo HTMLSELECT($cmd,0,'centros',$idcentro,'idcentro','nombrecentro',220); ?></div> |
---|
| 118 | <div><button type="submit" onclick="confirmar()"><?php echo $TbMsg["ACCESS_OK"]; ?></button></div> |
---|
[39a8a99] | 119 | </fieldset> |
---|
| 120 | </form> |
---|
| 121 | </div> |
---|
[bdf6991] | 122 | <div class="pie"> |
---|
| 123 | <?php |
---|
[e7bfe29] | 124 | // Añadir versión y URL al proyecto. |
---|
[bdf6991] | 125 | $versionfile="../doc/VERSION.txt"; |
---|
[7e11be6] | 126 | if (file_exists ($versionfile)) { |
---|
[7d54b0b] | 127 | echo '<span><a href="https://opengnsys.es/">'; |
---|
[bdf6991] | 128 | include ($versionfile); |
---|
| 129 | echo '</a></span>'; |
---|
[7e11be6] | 130 | } |
---|
[bdf6991] | 131 | ?> |
---|
| 132 | <form action="#" name="lang" method="post"> |
---|
| 133 | <?php echo HTMLSELECT($cmd,0,'idiomas',$idi,'nemonico','descripcion',80); ?> |
---|
| 134 | <button type="submit"><?php echo $TbMsg["ACCESS_CHOOSE"]; ?></button> |
---|
| 135 | </form> |
---|
| 136 | </div> |
---|
| 137 | <?php |
---|
[39a8a99] | 138 | //______________________________________________________________________________ |
---|
| 139 | // Posiciona cursor en campo usuario y muestra mensaje de error si lo hubiera |
---|
| 140 | echo '<script language="javascript">'; |
---|
| 141 | if (!empty($herror)) { |
---|
| 142 | if (!empty($TbErr[$herror])) { |
---|
| 143 | echo " alert('".$TbErr[$herror]."');"; |
---|
| 144 | } else { |
---|
| 145 | echo " alert('".$TbMsg["ACCESS_UNKNOWNERROR"]."');"; |
---|
| 146 | } |
---|
| 147 | } |
---|
| 148 | echo ' document.fdatos.usu.focus()'; |
---|
| 149 | echo '</script>'; |
---|
| 150 | //______________________________________________________________________________ |
---|
| 151 | ?> |
---|
| 152 | </body> |
---|
| 153 | </html> |
---|
| 154 | |
---|