source: trunk/login.php @ 1042

Revision 1042, 4.2 KB checked in by rafaelraymundo, 15 years ago (diff)

Ticket #562 - Realizados procedimentos para utilizacao de Certificado Digital no login

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2//Valida a existencia do cookie, antes de grava-lo
3if(isset($_COOKIE['contador'])) {
4        $valor_cookie = $_COOKIE['contador'];
5        if($_POST['user'] && $_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.....
22if($_GET['cd']=='1' || $_COOKIE['sessionid'] || $_GET['cd'] == 10)
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                // Force location to home, while logged in.
54                $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid'];
55                if(isset($GLOBALS['sessionid']) && $_GET['cd'] != 10)
56                        $GLOBALS['phpgw']->redirect_link('/home.php');
57                if ($GLOBALS['phpgw_info']['server']['use_https'] > 0)
58                {
59                        if ($_SERVER['HTTPS'] != 'on')
60                        {
61                                Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
62                                exit;
63                        }
64                }
65                       
66                if(function_exists('CreateObject'))
67                {
68                        $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions');
69                }
70                else
71                {
72                        Header('Location: setup/index.php');
73                        exit;
74                }
75        }
76        else
77        {
78                Header('Location: setup/index.php');
79                exit;
80        }
81
82        $GLOBALS['phpgw_info']['server']['template_dir'] = PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info']['login_template_set'];
83        $tmpl = CreateObject('phpgwapi.Template', $GLOBALS['phpgw_info']['server']['template_dir']);
84
85        // read the images from the login-template-set, not the (maybe not even set) users template-set
86        $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] = $GLOBALS['phpgw_info']['login_template_set'];
87
88        // This is used for system downtime, to prevent new logins.
89        if($GLOBALS['phpgw_info']['server']['deny_all_logins'])
90        {
91                $deny_msg=lang('Oops! You caught us in the middle of system maintainance.<br/>
92                Please, check back with us shortly.');
93
94                $tmpl->set_file(array
95                (
96                        'login_form' => 'login_denylogin.tpl'
97                ));
98
99                $tmpl->set_var('template_set','default');
100                $tmpl->set_var('deny_msg',$deny_msg);
101                $tmpl->pfp('loginout','login_form');
102                exit;
103        }
104        $tmpl->set_file(array('login_form' => 'login.tpl'));
105
106        // !! NOTE !!
107        // Do NOT and I repeat, do NOT touch ANYTHING to do with lang in this file.
108        // If there is a problem, tell me and I will fix it. (jengo)
109
110        // whoooo scaring
111
112        // ServerID => Identify the Apache Frontend.
113        if($GLOBALS['phpgw_info']['server']['usecookies'] == True && $GLOBALS['phpgw_info']['server']['use_frontend_id'])
114        {
115                $GLOBALS['phpgw']->session->phpgw_setcookie('serverID', $GLOBALS['phpgw_info']['server']['use_frontend_id']);
116        }
117
118$login_include = $GLOBALS['phpgw_info']['server']['template_dir'] . '/login_' .  $GLOBALS['phpgw_info']['login_template_set'] . '.php';
119
120if(!$login_include || !file_exists($login_include))
121        {
122                $aux = explode('phpgwapi',$GLOBALS['phpgw_info']['server']['template_dir']);
123                $login_include = $aux[0] . 'phpgwapi/templates/default/login_default.php';
124        }
125
126include($login_include);
127
128?>
129
Note: See TracBrowser for help on using the repository browser.