| 1 | <?php |
|---|
| 2 | // ***************************************************************************** |
|---|
| 3 | // Aplicación WEB: ogAdmWebCon |
|---|
| 4 | // Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla |
|---|
| 5 | // Fecha Creación: Agosto-2010 |
|---|
| 6 | // Nombre del fichero: acceso.php |
|---|
| 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 |
|---|
| 10 | // Fecha: 2012-02-07 |
|---|
| 11 | // ***************************************************************************** |
|---|
| 12 | session_start(); |
|---|
| 13 | if(isset($_SESSION)){ // Si existe algua sesión ... |
|---|
| 14 | session_unset(); // Elimina variables |
|---|
| 15 | session_destroy(); // Destruye sesi�n |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | // Cargar configuración. |
|---|
| 19 | include_once("controlacceso.php"); |
|---|
| 20 | include_once("./includes/CreaComando.php"); |
|---|
| 21 | include_once("./clases/AdoPhp.php"); |
|---|
| 22 | include_once("./includes/HTMLSELECT.php"); |
|---|
| 23 | |
|---|
| 24 | // Control de errores. |
|---|
| 25 | if (isset($_GET["herror"])) $herror=$_GET["herror"]; |
|---|
| 26 | if (isset($_POST["herror"])) $herror=$_POST["herror"]; |
|---|
| 27 | // Idioma. |
|---|
| 28 | if (isset($_POST["nemonico"])) $parmidi=$_POST["nemonico"]; |
|---|
| 29 | if (!empty ($parmidi) and file_exists ("idiomas/php/$parmidi/acceso_$parmidi.php")) { |
|---|
| 30 | $idi=$parmidi; |
|---|
| 31 | } |
|---|
| 32 | include ("idiomas/php/$idi/acceso_$idi.php"); |
|---|
| 33 | |
|---|
| 34 | $busidcentro=""; |
|---|
| 35 | $cmd=CreaComando($cnx); // Crea objeto comando |
|---|
| 36 | if (!$cmd) |
|---|
| 37 | die($TbMsg["ACCESS_ERROR"]); |
|---|
| 38 | |
|---|
| 39 | $rs=new Recordset; |
|---|
| 40 | $cmd->texto="SELECT * FROM centros"; |
|---|
| 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 | } |
|---|
| 55 | ?> |
|---|
| 56 | <html> |
|---|
| 57 | <head> |
|---|
| 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" /> |
|---|
| 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"].'");' ?> |
|---|
| 72 | document.fdatos.usu.focus(); |
|---|
| 73 | return(false) |
|---|
| 74 | } |
|---|
| 75 | if (document.fdatos.pss.value==""){ |
|---|
| 76 | <?php echo 'alert("'.$TbMsg["ACCESS_NOPASS"].'");' ?> |
|---|
| 77 | document.fdatos.pss.focus(); |
|---|
| 78 | return(false) |
|---|
| 79 | } |
|---|
| 80 | var p=document.fdatos.idcentro.selectedIndex; |
|---|
| 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> |
|---|
| 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> |
|---|
| 119 | </fieldset> |
|---|
| 120 | </form> |
|---|
| 121 | </div> |
|---|
| 122 | <div class="pie"> |
|---|
| 123 | <?php |
|---|
| 124 | // Añadir versión y URL al proyecto. |
|---|
| 125 | $versionfile="../doc/VERSION.txt"; |
|---|
| 126 | if (file_exists ($versionfile)) { |
|---|
| 127 | echo '<span><a href="https://opengnsys.es/">'; |
|---|
| 128 | include ($versionfile); |
|---|
| 129 | echo '</a></span>'; |
|---|
| 130 | } |
|---|
| 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 |
|---|
| 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 | |
|---|