1 | <?php |
---|
2 | //Valida a existencia do cookie, antes de grava-lo |
---|
3 | if(isset($_COOKIE['contador'])) { |
---|
4 | $valor_cookie = $_COOKIE['contador']; |
---|
5 | if( isset( $_POST['user'] ) && isset( $_POST['passwd'] ) ) |
---|
6 | { |
---|
7 | $valor_cookie = $valor_cookie + 1; |
---|
8 | setcookie("contador", $valor_cookie,0); |
---|
9 | } |
---|
10 | } |
---|
11 | //Cookie inexistente: tenta gravar um |
---|
12 | else |
---|
13 | { |
---|
14 | if (setcookie("contador", 1,0)) |
---|
15 | //echo "OK, cookie gravado."; |
---|
16 | $valor_cookie = 1; |
---|
17 | else |
---|
18 | //echo "Nao gravou o cookie"; |
---|
19 | $valor_cookie = "9999"; // forca captcha |
---|
20 | } |
---|
21 | // logout, inicia contador novamente..... |
---|
22 | if( ( isset( $_GET[ 'cd' ] ) && ( $_GET['cd']=='1' || $_GET['cd'] == 10 ) ) || ( isset( $_COOKIE['sessionid'] ) ) ) |
---|
23 | { |
---|
24 | $valor_cookie = 1; |
---|
25 | setcookie("contador", 1,0); |
---|
26 | } |
---|
27 | |
---|
28 | /**************************************************************************\ |
---|
29 | * eGroupWare login * |
---|
30 | * http://www.egroupware.org * |
---|
31 | * Originaly written by Dan Kuykendall <seek3r@phpgroupware.org> * |
---|
32 | * Joseph Engo <jengo@phpgroupware.org> * |
---|
33 | * Updated by Nilton Emilio Buhrer Neto <niltonneto@celepar.pr.gov.br> * |
---|
34 | * This program is free software; you can redistribute it and/or modify it * |
---|
35 | * under the terms of the GNU General Public License as published by the * |
---|
36 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
37 | * option) any later version. * |
---|
38 | \**************************************************************************/ |
---|
39 | |
---|
40 | $phpgw_info = array(); |
---|
41 | $submit = False; // set to some initial value |
---|
42 | |
---|
43 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
44 | 'disable_Template_class' => True, |
---|
45 | 'login' => True, |
---|
46 | 'currentapp' => 'login', |
---|
47 | 'noheader' => True |
---|
48 | ); |
---|
49 | |
---|
50 | if(file_exists('./header.inc.php')) |
---|
51 | { |
---|
52 | include('./header.inc.php'); |
---|
53 | |
---|
54 | $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid']; |
---|
55 | |
---|
56 | if(isset($GLOBALS['sessionid']) && $_GET['cd'] != 10) |
---|
57 | $GLOBALS['phpgw']->redirect_link('/'); |
---|
58 | |
---|
59 | if ($GLOBALS['phpgw_info']['server']['use_https'] > 0) |
---|
60 | { |
---|
61 | if ($_SERVER['HTTPS'] != 'on') |
---|
62 | { |
---|
63 | Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
---|
64 | exit; |
---|
65 | } |
---|
66 | } |
---|
67 | |
---|
68 | if(function_exists('CreateObject')) |
---|
69 | { |
---|
70 | $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions'); |
---|
71 | } |
---|
72 | else |
---|
73 | { |
---|
74 | Header('Location: setup/index.php'); |
---|
75 | exit; |
---|
76 | } |
---|
77 | } |
---|
78 | else |
---|
79 | { |
---|
80 | Header('Location: setup/index.php'); |
---|
81 | exit; |
---|
82 | } |
---|
83 | |
---|
84 | $GLOBALS['phpgw_info']['server']['template_dir'] = PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info']['login_template_set']; |
---|
85 | $tmpl = CreateObject('phpgwapi.Template', $GLOBALS['phpgw_info']['server']['template_dir']); |
---|
86 | |
---|
87 | // read the images from the login-template-set, not the (maybe not even set) users template-set |
---|
88 | $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] = $GLOBALS['phpgw_info']['login_template_set']; |
---|
89 | |
---|
90 | // This is used for system downtime, to prevent new logins. |
---|
91 | if($GLOBALS['phpgw_info']['server']['deny_all_logins']) |
---|
92 | { |
---|
93 | $deny_msg=lang('Oops! You caught us in the middle of system maintainance.<br/> |
---|
94 | Please, check back with us shortly.'); |
---|
95 | |
---|
96 | $tmpl->set_file(array |
---|
97 | ( |
---|
98 | 'login_form' => 'login_denylogin.tpl' |
---|
99 | )); |
---|
100 | |
---|
101 | $tmpl->set_var('template_set','default'); |
---|
102 | $tmpl->set_var('deny_msg',$deny_msg); |
---|
103 | $tmpl->pfp('loginout','login_form'); |
---|
104 | exit; |
---|
105 | } |
---|
106 | $tmpl->set_file(array('login_form' => 'login.tpl')); |
---|
107 | |
---|
108 | $tmpl->set_var('template',$GLOBALS['phpgw_info']['login_template_set']); |
---|
109 | $tmpl->set_var('lang',$_GET['lang']?$_GET['lang']:preg_replace("/\,.*/","",$GLOBALS['_SERVER']['HTTP_ACCEPT_LANGUAGE'])); |
---|
110 | |
---|
111 | if (count($GLOBALS['phpgw_info']['server']['login_logo_file']) > 0) |
---|
112 | $tmpl->set_var('logo_config',$GLOBALS['phpgw_info']['server']['login_logo_file']); |
---|
113 | else |
---|
114 | $tmpl->set_var('logo_config','<a title="Governo do Paraná" href="http://www.pr.gov.br" target="_blank"><img src="phpgwapi/templates/'.$GLOBALS['phpgw_info']['login_template_set'].'/images/logo_governo.gif" alt="governo" border="0"></a></td> |
---|
115 | <td><div align="center"><font color="#9a9a9a" face="Verdana, Arial, Helvetica, sans-serif" size="1"> |
---|
116 | <a title="Celepar Informática do Paraná" target="_blank" href="http://www.celepar.pr.gov.br/"> |
---|
117 | <img alt="celepar" src="phpgwapi/templates/'.$GLOBALS['phpgw_info']['login_template_set'].'/images/logo_celepar.gif" border="0"></a><br></font></div>'); |
---|
118 | // !! NOTE !! |
---|
119 | // Do NOT and I repeat, do NOT touch ANYTHING to do with lang in this file. |
---|
120 | // If there is a problem, tell me and I will fix it. (jengo) |
---|
121 | |
---|
122 | // whoooo scaring |
---|
123 | |
---|
124 | // ServerID => Identify the Apache Frontend. |
---|
125 | if($GLOBALS['phpgw_info']['server']['usecookies'] == True && $GLOBALS['phpgw_info']['server']['use_frontend_id']) |
---|
126 | { |
---|
127 | $GLOBALS['phpgw']->session->phpgw_setcookie('serverID', $GLOBALS['phpgw_info']['server']['use_frontend_id']); |
---|
128 | } |
---|
129 | |
---|
130 | include(personalize_include_path('phpgwapi','login')); |
---|
131 | ?> |
---|
132 | |
---|