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