source: admin/WebConsole/index.php @ c7ade22

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 c7ade22 was 53419be, checked in by ramon <ramongomez@…>, 8 years ago

#708 #718: Usar siempre HTTPS en todo el servidor OpenGnsys (incluido descargas y REST).

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

  • Property mode set to 100644
File size: 4.9 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 WHERE idcentro='$idc'";
41        $cmd->texto="SELECT * FROM  centros ";
42        $rs->Comando=&$cmd;
43        if (!$rs->Abrir()) return(false); // Error al abrir recordset
44        $rs->Primero();
45        if (!$rs->EOF){
46        $busidcentro=$rs->campos["identidad"];
47        }$rs->Cerrar();
48       
49// Valores por defecto.
50$herror=0;
51if (empty($busidcentro)){
52        $idcentro="";
53}else{
54        $idcentro=$busidcentro;
55}
56?>
57<html>
58<head>
59<title><?php echo $TbMsg["ACCESS_TITLE"];?></title>
60<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
61<link rel="shortcut icon" href="images/iconos/logocirculos.png" type="image/png" />
62<link rel="stylesheet" type="text/css" href="estilos.css" />
63<script language="javascript">
64//______________________________________________________________________________
65function confirmar(){
66        if (comprobar_datos())
67                document.fdatos.submit();
68}
69//______________________________________________________________________________
70function comprobar_datos(){
71        if (document.fdatos.usu.value==""){
72                <?php echo 'alert("'.$TbMsg["ACCESS_NOUSER"].'");' ?>
73                document.fdatos.usu.focus()
74                return(false)
75        }
76        if (document.fdatos.pss.value==""){
77                <?php echo 'alert("'.$TbMsg["ACCESS_NOPASS"].'");' ?>
78                document.fdatos.pss.focus()
79                return(false)
80        }
81        var  p=document.fdatos.idcentro.selectedIndex
82        if (p==0){ 
83                <?php echo 'var res=confirm("'.$TbMsg["ACCESS_NOUNIT"].'");' ?>
84        if(!res)
85                return(false)
86        }
87        return(true)
88}
89//______________________________________________________________________________
90function PulsaEnter(oEvento){
91    var iAscii;
92    if (oEvento.keyCode)
93        iAscii = oEvento.keyCode;
94    else{
95                if (oEvento.which)
96                        iAscii = oEvento.which;
97                else
98                        return false;
99        }
100    if (iAscii == 13)  confirmar();
101        return true;
102}
103//______________________________________________________________________________
104</script>
105</head>
106
107<body>
108<div class="acceso">
109<h1> <?php echo $TbMsg["ACCESS_HEADING"]; ?> </h1>
110<h2> <?php echo $TbMsg["ACCESS_SUBHEAD"]; ?> </h2>
111<form action="controlpostacceso.php" name="fdatos" method="post">
112    <fieldset>
113        <p><label for="usu"><?php echo $TbMsg["ACCESS_USERNAME"]; ?></label>
114           <input name="usu" type="text" onkeypress="PulsaEnter(event)" /></p>
115        <p><label for="pss"><?php echo $TbMsg["ACCESS_PASSWORD"]; ?></label>
116           <input name="pss" type="password" onkeypress="PulsaEnter(event)" /></p>
117        <p><label for="idcentro"><?php echo $TbMsg["ACCESS_ORGUNIT"]; ?></label>
118           <?php echo HTMLSELECT($cmd,0,'centros',$idcentro,'idcentro','nombrecentro',220); ?></p>
119        <button type="submit" onclick="confirmar()"><?php echo $TbMsg["ACCESS_OK"]; ?></button>
120    </fieldset>
121</form>
122</div>
123<div class="pie">
124<?php
125// Añadir versión y URL al proyecto.
126$versionfile="../doc/VERSION.txt";
127if (file_exists ($versionfile)) {
128        echo '<span><a href="http://opengnsys.es/">';
129        include ($versionfile);
130        echo '</a></span>';
131}
132?>
133<form action="#" name="lang" method="post">
134      <?php echo HTMLSELECT($cmd,0,'idiomas',$idi,'nemonico','descripcion',80); ?>
135      <button type="submit"><?php echo $TbMsg["ACCESS_CHOOSE"]; ?></button>
136</form>
137</div>
138<?php
139//______________________________________________________________________________
140// Posiciona cursor en campo usuario y muestra mensaje de error si lo hubiera
141echo '<script language="javascript">';
142if (!empty($herror)) {
143        if (!empty($TbErr[$herror])) {
144                echo "  alert('".$TbErr[$herror]."');";
145        } else {
146                echo "  alert('".$TbMsg["ACCESS_UNKNOWNERROR"]."');";
147        }
148}
149echo '  document.fdatos.usu.focus()';
150echo '</script>';
151//______________________________________________________________________________
152?>
153</body>
154</html>
155
Note: See TracBrowser for help on using the repository browser.