| 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 | |
|---|
| 28 | // Valores por defecto. |
|---|
| 29 | $herror=0; |
|---|
| 30 | $idcentro=""; |
|---|
| 31 | |
|---|
| 32 | // Control de errores. |
|---|
| 33 | if (isset($_GET["herror"])) $herror=$_GET["herror"]; |
|---|
| 34 | if (isset($_POST["herror"])) $herror=$_POST["herror"]; |
|---|
| 35 | // Idioma. |
|---|
| 36 | if (isset($_POST["nemonico"])) $parmidi=$_POST["nemonico"]; |
|---|
| 37 | if (!empty ($parmidi) and file_exists ("idiomas/php/$parmidi/acceso_$parmidi.php")) { |
|---|
| 38 | $idi=$parmidi; |
|---|
| 39 | } |
|---|
| 40 | include ("idiomas/php/$idi/acceso_$idi.php"); |
|---|
| 41 | |
|---|
| 42 | $cmd=CreaComando($cnx); // Crea objeto comando |
|---|
| 43 | if (!$cmd) |
|---|
| 44 | die($TbMsg["ACCESS_ERROR"]); |
|---|
| 45 | |
|---|
| 46 | ?> |
|---|
| 47 | <html> |
|---|
| 48 | <title><?php echo $TbMsg["ACCESS_TITLE"];?></title> |
|---|
| 49 | <head> |
|---|
| 50 | <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
|---|
| 51 | <link rel="stylesheet" type="text/css" href="estilos.css"> |
|---|
| 52 | <script language="javascript"> |
|---|
| 53 | //______________________________________________________________________________ |
|---|
| 54 | function confirmar(){ |
|---|
| 55 | if (comprobar_datos()) |
|---|
| 56 | document.fdatos.submit(); |
|---|
| 57 | } |
|---|
| 58 | //______________________________________________________________________________ |
|---|
| 59 | function comprobar_datos(){ |
|---|
| 60 | if (document.fdatos.usu.value==""){ |
|---|
| 61 | <?php echo 'alert("'.$TbMsg["ACCESS_NOUSER"].'");' ?> |
|---|
| 62 | document.fdatos.usu.focus() |
|---|
| 63 | return(false) |
|---|
| 64 | } |
|---|
| 65 | if (document.fdatos.pss.value==""){ |
|---|
| 66 | <?php echo 'alert("'.$TbMsg["ACCESS_NOPASS"].'");' ?> |
|---|
| 67 | document.fdatos.pss.focus() |
|---|
| 68 | return(false) |
|---|
| 69 | } |
|---|
| 70 | var p=document.fdatos.idcentro.selectedIndex |
|---|
| 71 | if (p==0){ |
|---|
| 72 | <?php echo 'var res=confirm("'.$TbMsg["ACCESS_NOUNIT"].'");' ?> |
|---|
| 73 | if(!res) |
|---|
| 74 | return(false) |
|---|
| 75 | } |
|---|
| 76 | return(true) |
|---|
| 77 | } |
|---|
| 78 | //______________________________________________________________________________ |
|---|
| 79 | function PulsaEnter(oEvento){ |
|---|
| 80 | var iAscii; |
|---|
| 81 | if (oEvento.keyCode) |
|---|
| 82 | iAscii = oEvento.keyCode; |
|---|
| 83 | else{ |
|---|
| 84 | if (oEvento.which) |
|---|
| 85 | iAscii = oEvento.which; |
|---|
| 86 | else |
|---|
| 87 | return false; |
|---|
| 88 | } |
|---|
| 89 | if (iAscii == 13) confirmar(); |
|---|
| 90 | return true; |
|---|
| 91 | } |
|---|
| 92 | //______________________________________________________________________________ |
|---|
| 93 | </script> |
|---|
| 94 | </head> |
|---|
| 95 | |
|---|
| 96 | <body> |
|---|
| 97 | <div class="acceso"> |
|---|
| 98 | <h1> <?php echo $TbMsg["ACCESS_HEADING"]; ?> </h1> |
|---|
| 99 | <h2> <?php echo $TbMsg["ACCESS_SUBHEAD"]; ?> </h2> |
|---|
| 100 | <form action="controlpostacceso.php" name="fdatos" method="post"> |
|---|
| 101 | <fieldset> |
|---|
| 102 | <p><label for="usu"><?php echo $TbMsg["ACCESS_USERNAME"]; ?></label> |
|---|
| 103 | <input name="usu" type="text" onkeypress="PulsaEnter(event)" /></p> |
|---|
| 104 | <p><label for="pss"><?php echo $TbMsg["ACCESS_PASSWORD"]; ?></label> |
|---|
| 105 | <input name="pss" type="password" onkeypress="PulsaEnter(event)" /></p> |
|---|
| 106 | <p><label for="idcentro"><?php echo $TbMsg["ACCESS_ORGUNIT"]; ?></label> |
|---|
| 107 | <?php echo HTMLSELECT($cmd,0,'centros',$idcentro,'idcentro','nombrecentro',220); ?></p> |
|---|
| 108 | <button type="submit" onclick="confirmar()"><?php echo $TbMsg["ACCESS_OK"]; ?></button> |
|---|
| 109 | </fieldset> |
|---|
| 110 | </form> |
|---|
| 111 | </div> |
|---|
| 112 | <div class="pie"> |
|---|
| 113 | <?php |
|---|
| 114 | // Añadir versión y URL al proyecto. |
|---|
| 115 | $versionfile="../doc/VERSION.txt"; |
|---|
| 116 | if (file_exists ($versionfile)) { |
|---|
| 117 | echo '<span><a href="http://opengnsys.es/">'; |
|---|
| 118 | include ($versionfile); |
|---|
| 119 | echo '</a></span>'; |
|---|
| 120 | } |
|---|
| 121 | ?> |
|---|
| 122 | <form action="#" name="lang" method="post"> |
|---|
| 123 | <?php echo HTMLSELECT($cmd,0,'idiomas',$idi,'nemonico','descripcion',80); ?> |
|---|
| 124 | <button type="submit"><?php echo $TbMsg["ACCESS_CHOOSE"]; ?></button> |
|---|
| 125 | </form> |
|---|
| 126 | </div> |
|---|
| 127 | <?php |
|---|
| 128 | //______________________________________________________________________________ |
|---|
| 129 | // Posiciona cursor en campo usuario y muestra mensaje de error si lo hubiera |
|---|
| 130 | echo '<script language="javascript">'; |
|---|
| 131 | if (!empty($herror)) { |
|---|
| 132 | if (!empty($TbErr[$herror])) { |
|---|
| 133 | echo " alert('".$TbErr[$herror]."');"; |
|---|
| 134 | } else { |
|---|
| 135 | echo " alert('".$TbMsg["ACCESS_UNKNOWNERROR"]."');"; |
|---|
| 136 | } |
|---|
| 137 | } |
|---|
| 138 | echo ' document.fdatos.usu.focus()'; |
|---|
| 139 | echo '</script>'; |
|---|
| 140 | //______________________________________________________________________________ |
|---|
| 141 | ?> |
|---|
| 142 | </body> |
|---|
| 143 | </html> |
|---|
| 144 | |
|---|