source: admin/WebConsole/index.php @ bdf6991

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since bdf6991 was bdf6991, checked in by ramon <ramongomez@…>, 13 years ago

Versión 1.0.3, #483 #492: Pie de la pantalla de acceso con selector de idioma y versión con URL al proyecto.

git-svn-id: https://opengnsys.es/svn/branches/version1.0@2541 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100644
File size: 4.5 KB
Line 
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// *****************************************************************************
12if(isset($_SESSION)){   // Si existe algua sesión ...
13        session_unset(); // Elimina variables
14        session_destroy(); // Destruye sesión
15}
16# Cambiar a HTTPS
17if (empty ($_SERVER["HTTPS"])) {
18        header ("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"]);
19        exit (0);
20}
21
22// Cargar configuración.
23include_once("controlacceso.php");
24include_once("./includes/CreaComando.php");
25include_once("./clases/AdoPhp.php");
26include_once("./includes/HTMLSELECT.php");
27
28// Valores por defecto.
29$herror=0;
30$idcentro="";
31
32// Control de errores.
33if (isset($_GET["herror"])) $herror=$_GET["herror"];
34if (isset($_POST["herror"])) $herror=$_POST["herror"];
35// Idioma.
36if (isset($_POST["nemonico"])) $parmidi=$_POST["nemonico"];
37if (!empty ($parmidi) and file_exists ("idiomas/php/$parmidi/acceso_$parmidi.php")) {
38        $idi=$parmidi;
39}
40include ("idiomas/php/$idi/acceso_$idi.php");
41
42$cmd=CreaComando($cnx); // Crea objeto comando
43if (!$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//______________________________________________________________________________
54function confirmar(){
55        if (comprobar_datos())
56                document.fdatos.submit();
57}
58//______________________________________________________________________________
59function 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//______________________________________________________________________________
79function 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";
116if (file_exists ($versionfile) {
117        echo '<span><a href="http://opengnsys.es/">';
118        include ($versionfile);
119        echo '</a></span>';
120?>
121<form action="#" name="lang" method="post">
122      <?php echo HTMLSELECT($cmd,0,'idiomas',$idi,'nemonico','descripcion',80); ?>
123      <button type="submit"><?php echo $TbMsg["ACCESS_CHOOSE"]; ?></button>
124</form>
125</div>
126<?php
127//______________________________________________________________________________
128// Posiciona cursor en campo usuario y muestra mensaje de error si lo hubiera
129echo '<script language="javascript">';
130if (!empty($herror)) {
131        if (!empty($TbErr[$herror])) {
132                echo "  alert('".$TbErr[$herror]."');";
133        } else {
134                echo "  alert('".$TbMsg["ACCESS_UNKNOWNERROR"]."');";
135        }
136}
137echo '  document.fdatos.usu.focus()';
138echo '</script>';
139//______________________________________________________________________________
140?>
141</body>
142</html>
143
Note: See TracBrowser for help on using the repository browser.