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