Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

user/login.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: login.php 9518 2002-05-08 11:51:36Z vl $
5 //
6 // Created on: <20-Sep-2000 13:32:11 ce>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 // include_once( "classes/INIFile.php" );
28 // include_once( "classes/eztemplate.php" );
29 // include_once( "classes/ezlog.php" );
30 // include_once( "classes/ezhttptool.php" );
31 // include_once( "classes/eztexttool.php" );
32
33 $ini =& eZINI::instance( 'site.ini' );
34 $Language = $ini->variable( "eZUserMain", "Language" );
35 $UserWithAddress = $ini->variable( "eZUserMain", "UserWithAddress" );
36
37 // include_once( "ezuser/classes/ezuser.php" );
38 // include_once( "ezuser/classes/ezusergroup.php" );
39 // include_once( "ezuser/classes/ezmodule.php" );
40 // include_once( "ezuser/classes/ezpermission.php" );
41 // include_once( "ezsession/classes/ezsession.php" );
42
43 if ( isset( $Forgot ) )
44 {
45 eZHTTPTool::header( "Location: /user/forgot/" );
46 exit();
47 }
48
49 if ( isset( $Register ) )
50 {
51 if ( $UserWidthAddress == "enabled" )
52 {
53 eZHTTPTool::header( "Location: /user/userwithaddress/new/" );
54 }
55 else
56 {
57 eZHTTPTool::header( "Location: /user/user/new/" );
58 }
59 exit();
60 }
61
62 unset ( $t );
63
64 // Template
65 $t = new eZTemplate( "kernel/ezuser/user/" . $ini->variable( "eZUserMain", "TemplateDir" ),
66 "kernel/ezuser/user/intl", $Language, "login.php" );
67
68 $t->setAllStrings();
69
70 $t->set_file( array("login" => "login.tpl") );
71
72 $t->set_block( "login", "buttons_tpl", "buttons" );
73
74 $t->set_var( "buttons", "" );
75 if ( $ini->variable( "eZUserMain", "RequireUserLogin" ) != "enabled" )
76 $t->parse( "buttons", "buttons_tpl" );
77 else
78 $t->set_var( "buttons", "" );
79
80
81 if ( isset( $Action ) && $Action == "login" )
82 {
83 $user = new eZUser();
84 $user = $user->validateUser( $_REQUEST['Username'], $_REQUEST['Password'] );
85
86 if ( $user )
87 {
88 if ( $user->get( $user->id() ) )
89 {
90 $logins = $user->getLogins( $user->id() );
91 $AllowSimultaneousLogins = $ini->variable( "eZUserMain", "SimultaneousLogins" );
92
93 if ( $AllowSimultaneousLogins == "disabled" )
94 {
95 $MaxLogins = "1";
96 }
97 else
98 {
99 $MaxLogins = $user->simultaneousLogins();
100 }
101
102 if ( ( $MaxLogins == "0" ) || ( $logins < $MaxLogins ) )
103 {
104 eZPBLog::writeNotice( "User login: $Username from IP: $REMOTE_ADDR" );
105 eZUser::loginUser( $user );
106
107 if ( $user->cookieLogin() == true )
108 {
109 $user->setCookieValues();
110 }
111
112 $mainGroup = $user->groupDefinition( true );
113 if ( ( $mainGroup ) && $mainGroup->groupURL() )
114 {
115 eZHTTPTool::header( "Location: " . $mainGroup->groupURL() );
116 exit();
117 }
118 else if ( isset( $_REQUEST['RedirectURL'] ) )
119 {
120 $stringTmp = preg_split( "/", $_REQUEST['RedirectURL'] );
121
122 if ( $stringTmp[2] == "norights" )
123 {
124 eZHTTPTool::header( "Location: /" );
125 exit();
126 }
127 else
128 {
129 if ( $_REQUEST['RedirectURL'] == "" )
130 {
131 $_REQUEST['RedirectURL'] = "/";
132 }
133
134 eZHTTPTool::header( "Location: ".$_REQUEST['RedirectURL'] );
135 exit();
136 }
137 }
138 else
139 {
140 eZHTTPTool::header( "Location: /" );
141 exit();
142 }
143 }
144 else
145 {
146 eZPBLog::writeWarning( "Max limit reached: $Username from IP: $REMOTE_ADDR" );
147 eZHTTPTool::header( "Location: /user/norights/?Error=MaxLogins&RedirectURL=$RedirectURL" );
148 exit();
149 }
150 }
151 else
152 {
153 eZPBLog::writeError( "Couldn't recieve userinformastion on : $Username from IP: $REMOTE_ADDR" );
154 eZHTTPTool::header( "Location: /user/norights/?Error=UnknownError&RedirectURL=$RedirectURL" );
155 exit();
156 }
157 }
158 else
159 {
160 eZPBLog::writeWarning( "Bad login: $Username from IP: $REMOTE_ADDR" );
161 eZHTTPTool::header( "Location: /user/norights/?Error=WrongPassword&RedirectURL=$RedirectURL" );
162 exit();
163 }
164
165 }
166 else
167 {
168 if( !isset( $RedirectURL ) )
169 $RedirectURL = false;
170 }
171
172 if ( isset( $Action ) && $Action == "logout" )
173 {
174 eZUser::clearAutoCookieLogin();
175 eZUser::logout();
176 eZHTTPTool::header( "Location: /" );
177 exit();
178 }
179
180 $t->set_var( "redirect_url", eZTextTool::htmlspecialchars( $RedirectURL ) );
181 // $t->set_var( "redirect_url", $RedirectURL );
182 $t->set_var( "action_value", "login" );
183
184 $t->pparse( "output", "login" );
185
186 ?>
$mainGroup
$mainGroup
Definition: admin/useredit.php:451
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZPBLog\writeNotice
static writeNotice( $notice)
Definition: ezpblog.php:166
eZPBLog\writeError
writeError( $error)
Definition: ezpblog.php:188
eZPBLog\writeWarning
static writeWarning( $warning)
Definition: ezpblog.php:177
eZTemplate
Definition: eztemplate.php:107
eZTextTool\htmlspecialchars
static htmlspecialchars( $string)
Definition: eztexttool.php:144
eZUser
Definition: ezuser.php:76
eZUser\logout
static logout()
Definition: ezuser.php:876
eZUser\loginUser
static loginUser(&$user)
Definition: ezuser.php:809
eZUser\clearAutoCookieLogin
static clearAutoCookieLogin()
Definition: ezuser.php:857
$Action
$Action
Definition: companysearch.php:80
$RedirectURL
$RedirectURL
Definition: ezforum/user/userlogin.php:91
exit
exit
Definition: folder.php:81
$user
$user
Definition: user/adlist.php:39
$t
$t
Definition: user/login.php:65
$Language
$Language
Definition: user/login.php:34
$ini
$ini
Definition: user/login.php:33
$UserWithAddress
$UserWithAddress
Definition: user/login.php:35
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.