1 | <? |
---|
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 | // Fecha Última modificación: Agosto-2010 |
---|
7 | // Nombre del fichero: acceso.php |
---|
8 | // Descripción : Presenta la pantalla de login de la aplicación |
---|
9 | // ******************************************************************************************************** |
---|
10 | |
---|
11 | # Cambiar a HTTPS |
---|
12 | if (empty ($_SERVER["HTTPS"])) { |
---|
13 | header ("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"]); |
---|
14 | exit (0); |
---|
15 | } |
---|
16 | |
---|
17 | include_once("controlacceso.php"); |
---|
18 | include_once("./includes/CreaComando.php"); |
---|
19 | include_once("./clases/AdoPhp.php"); |
---|
20 | include_once("./includes/HTMLSELECT.php"); |
---|
21 | //________________________________________________________________________________________________________ |
---|
22 | $cmd=CreaComando($cnx); // Crea objeto comando |
---|
23 | if (!$cmd) |
---|
24 | die("Error de acceso"); |
---|
25 | //________________________________________________________________________________________________________ |
---|
26 | $herror=0; |
---|
27 | if (isset($_GET["herror"])) $herror=$_GET["herror"]; |
---|
28 | if (isset($_POST["herror"])) $herror=$_POST["herror"]; |
---|
29 | |
---|
30 | $TbErr=array(); |
---|
31 | $TbErr[0]="NO ERRORS"; |
---|
32 | $TbErr[1]="Attention: You must access the application via the homepage"; |
---|
33 | $TbErr[2]="Attention: The application not have access to the database server"; |
---|
34 | $TbErr[3]="Attention: There are problems to retrieve the record, it may have been removed"; |
---|
35 | $TbErr[4]="Attention: You do not have access to this application"; |
---|
36 | $TbMsg=array(); |
---|
37 | $TbMsg["ACCESS_TITLE"]="OpenGnSys: Labs web administration"; |
---|
38 | $TbMsg["ACCESS_OU"]="Organitational Unit"; |
---|
39 | $TbMsg["ACCESS_NOUSER"]="You must enter a username"; |
---|
40 | $TbMsg["ACCESS_NOPASS"]="You must enter a password"; |
---|
41 | $TbMsg["ACCESS_NOUNIT"]='You have not entered any Organizational Unit.\nYou will NOT have access to the system unless that you are a main administrator of the Application.\nDo you want to access with this profile?'; |
---|
42 | |
---|
43 | //________________________________________________________________________________________________________ |
---|
44 | ?> |
---|
45 | <HTML> |
---|
46 | <title><?php echo $TbMsg["ACCESS_TITLE"];?></title> |
---|
47 | <HEAD> |
---|
48 | <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
---|
49 | <LINK rel="stylesheet" type="text/css" href="estilos.css"> |
---|
50 | </HEAD> |
---|
51 | <SCRIPT LANGUAGE="JAVASCRIPT"> |
---|
52 | //________________________________________________________________________________________________________ |
---|
53 | function confirmar(){ |
---|
54 | if (comprobar_datos()) |
---|
55 | document.fdatos.submit(); |
---|
56 | } |
---|
57 | //________________________________________________________________________________________________________ |
---|
58 | function comprobar_datos(){ |
---|
59 | if (document.fdatos.usu.value==""){ |
---|
60 | <?php echo 'alert("'.$TbMsg["ACCESS_NOUSER"].'");' ?> |
---|
61 | document.fdatos.usu.focus() |
---|
62 | return(false) |
---|
63 | } |
---|
64 | if (document.fdatos.pss.value==""){ |
---|
65 | <?php echo 'alert("'.$TbMsg["ACCESS_NOUSER"].'");' ?> |
---|
66 | document.fdatos.pss.focus() |
---|
67 | return(false) |
---|
68 | } |
---|
69 | var p=document.fdatos.idcentro.selectedIndex |
---|
70 | if (p==0){ |
---|
71 | <?php echo 'var res=confirm("'.$TbMsg["ACCESS_NOUNIT"].'");' ?> |
---|
72 | if(!res) |
---|
73 | return(false) |
---|
74 | } |
---|
75 | return(true) |
---|
76 | } |
---|
77 | //______________________________________________________________________________________________________ |
---|
78 | function PulsaEnter(oEvento){ |
---|
79 | var iAscii; |
---|
80 | if (oEvento.keyCode) |
---|
81 | iAscii = oEvento.keyCode; |
---|
82 | else{ |
---|
83 | if (oEvento.which) |
---|
84 | iAscii = oEvento.which; |
---|
85 | else |
---|
86 | return false; |
---|
87 | } |
---|
88 | if (iAscii == 13) confirmar(); |
---|
89 | return true; |
---|
90 | } |
---|
91 | //________________________________________________________________________________________________________ |
---|
92 | </SCRIPT> |
---|
93 | </HEAD> |
---|
94 | <BODY> |
---|
95 | <DIV style="POSITION:absolute;top:90;left:250"> |
---|
96 | <FORM action="controlpostacceso.php" name="fdatos" method="post"> |
---|
97 | <DIV align="center"> |
---|
98 | <IMG src="./images/login_esp.jpg" width=500 > |
---|
99 | <INPUT onkeypress="PulsaEnter(event)" name="usu" |
---|
100 | style="POSITION:absolute;top:125px;left:365px;width:90;height:20;COLOR: #999999; FONT-FAMILY: Verdana; FONT-SIZE: 12px;"> |
---|
101 | <INPUT onkeypress="PulsaEnter(event)" name="pss" type="password" |
---|
102 | style="POSITION:absolute;top:160px;left:365;width:90;height:20;COLOR: #999999; FONT-FAMILY: Verdana; FONT-SIZE: 12px;"> |
---|
103 | |
---|
104 | <div style="position:absolute; top:180px; left:265; color:#F9F9F9; font-family:Verdana; font-size:12px;"> |
---|
105 | <?php |
---|
106 | echo '<p>'.$TbMsg["ACCESS_OU"].'<br>'; |
---|
107 | echo HTMLSELECT($cmd,0,'centros',$idcentro,'idcentro','nombrecentro',220); |
---|
108 | ?> |
---|
109 | </p></div> |
---|
110 | |
---|
111 | <IMG onclick="confirmar()" src="./images/botonok.gif" style="POSITION:absolute;top:240;left:400;CURSOR: hand"> |
---|
112 | </DIV> |
---|
113 | </FORM> |
---|
114 | </DIV> |
---|
115 | <? |
---|
116 | //________________________________________________________________________________________________________ |
---|
117 | echo '<DIV style="POSITION: absolute;LEFT: 20px;TOP:300px;visibility:hidden" height=300 width=300>'; |
---|
118 | echo '<IFRAME scrolling=yes height=300 width=310 id="iframes_comodin" src="./nada.php"></IFRAME>'; |
---|
119 | echo '</DIV>'; |
---|
120 | //________________________________________________________________________________________________________ |
---|
121 | // Posiciona cursor en campo usuario y muestra mensaje de error si lo hubiera |
---|
122 | echo '<SCRIPT LANGUAGE="javascript">'; |
---|
123 | if (!empty($herror)) |
---|
124 | echo " alert('".$TbErr[$herror]."');"; |
---|
125 | echo 'document.fdatos.usu.focus()'; |
---|
126 | echo '</SCRIPT>'; |
---|
127 | //________________________________________________________________________________________________________ |
---|
128 | ?> |
---|
129 | </BODY> |
---|
130 | </HTML> |
---|
131 | |
---|