source: admin/WebConsole/index.php

qndtest
Last change on this file was bf4b65c, checked in by Ramón M. Gómez <ramongomez@…>, 6 years ago

#843: Web interface uses new version file and correcting some errata.

  • Property mode set to 100644
File size: 5.1 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// *****************************************************************************
12session_start();
13if(isset($_SESSION)){   // Si existe algua sesión ...
14        session_unset(); // Elimina variables
15        session_destroy(); // Destruye sesi�n
16}
17
18// Cargar configuración.
19include_once("controlacceso.php");
20include_once("./includes/CreaComando.php");
21include_once("./clases/AdoPhp.php");
22include_once("./includes/HTMLSELECT.php");
23
24// Control de errores.
25if (isset($_GET["herror"])) $herror=$_GET["herror"]; 
26if (isset($_POST["herror"])) $herror=$_POST["herror"]; 
27// Idioma.
28if (isset($_POST["nemonico"])) $parmidi=$_POST["nemonico"]; 
29if (!empty ($parmidi) and file_exists ("idiomas/php/$parmidi/acceso_$parmidi.php")) {
30        $idi=$parmidi;
31}
32include ("idiomas/php/$idi/acceso_$idi.php");
33
34$busidcentro="";
35$cmd=CreaComando($cnx); // Crea objeto comando
36if (!$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;
50if (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//______________________________________________________________________________
64function confirmar(){
65        if (comprobar_datos())
66                document.fdatos.submit();
67}
68//______________________________________________________________________________
69function 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//______________________________________________________________________________
89function 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<span><a href="https://opengnsys.es/">
124<?php
125// Añadir versión en el enlace a la URL del proyecto.
126$data = json_decode(@file_get_contents(__DIR__ . '/../doc/VERSION.json'));
127if (empty($data->project)) {
128    echo "OpenGnsys";
129} else {
130    echo @$data->project.' '
131        .@$data->version.' '
132        .(isset($data->codename) ? '('.$data->codename.') ' : '')
133        .@$data->release;
134}
135?>
136</a></span>
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
143//______________________________________________________________________________
144// Posiciona cursor en campo usuario y muestra mensaje de error si lo hubiera
145echo '<script language="javascript">';
146if (!empty($herror)) {
147        if (!empty($TbErr[$herror])) {
148                echo "  alert('".$TbErr[$herror]."');";
149        } else {
150                echo "  alert('".$TbMsg["ACCESS_UNKNOWNERROR"]."');";
151        }
152}
153echo '  document.fdatos.usu.focus()';
154echo '</script>';
155//______________________________________________________________________________
156?>
157</body>
158</html>
159
Note: See TracBrowser for help on using the repository browser.