2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/14/2003 *
4 * =================== Last change: 04/28/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-login.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Login area (redirects to the real login module) *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Loginbereich (leitet an das richtige Lgin-Modul *
13 * -------------------------------------------------------------------- *
16 * $Tag:: 0.2.1-FINAL $ *
18 * Needs to be in all Files and every File needs "svn propset *
19 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
20 * -------------------------------------------------------------------- *
21 * Copyright (c) 2003 - 2009 by Roland Haeder *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
40 // Some security stuff...
41 if (!defined('__SECURITY')) {
45 // Add description as navigation point
46 addMenuDescription('guest', __FILE__);
48 if ((!isExtensionActive('user')) && (!isAdmin())) {
49 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('user'));
53 // Initialize variables
61 if ((isMemberIdSet()) && (isSessionVariableSet('u_hash'))) {
62 // Maybe, then continue with it
63 $userid = getMemberId();
64 } elseif ((isPostRequestParameterSet('id')) && (isPostRequestParameterSet('password')) && (isFormSent())) {
65 // Set userid and crypt password when login data was submitted
66 if ((isExtensionActive('nickname')) && (isNicknameUsed(postRequestParameter('id')))) {
68 $userid = SQL_ESCAPE(postRequestParameter('id'));
70 // Direct userid entered
71 $userid = bigintval(postRequestParameter('id'));
73 } elseif (isPostRequestParameterSet('new_pass')) {
74 // New password requested
76 if ((isPostRequestParameterSet('id')) && (postRequestParameter('id') > 0)) $userid = bigintval(postRequestParameter('id'));
79 $userid = '0'; $hash = '';
83 // Login immidiately...
84 $URL = 'modules.php?module=login';
85 } elseif ((isFormSent()) && ('' . $userid . '' != '' . postRequestParameter('id') . '')) {
86 // Invalid input (no nickname extension installed but nickname entered)
87 $errorCode = getCode('EXTENSION_PROBLEM');
88 } elseif (isFormSent()) {
89 // Try the login (see inc/libs/user_functions.php)
90 $URL = doUserLogin(postRequestParameter('id'), postRequestParameter('password'));
91 } elseif ((isPostRequestParameterSet('new_pass')) && (isset($userid))) {
92 // Try the userid/email lookup (see inc/libs/user_functions.php)
93 $errorCode = doNewUserPassword(postRequestParameter('email'), $userid);
97 if (isGetRequestParameterSet('login')) {
99 $errorCode = getRequestParameter('login');
102 // No problems, no output by detault
103 $content['message'] = '';
106 if (!empty($errorCode)) {
107 // @TODO Move this HTML code into a template
109 <td width=\"10\" class=\"seperator\"> </td>
110 <td colspan=\"7\" align=\"center\">
111 <span class=\"guest_failed\">";
113 // Do we have a userid set?
114 if (isSessionVariableSet('current_userid')) {
115 // Then prefetch data for this account
116 fetchUserData(getSession('current_userid'));
119 // Convert the code to message
120 $message .= getMessageFromErrorCode($errorCode);
122 // Continue with HTML
125 <td width=\"10\" class=\"seperator\"> </td>
127 $content['message'] = $message;
130 // Display login form with resend-password form
131 if (isExtensionActive('nickname')) {
132 loadTemplate('guest_nickname_login', false, $content);
134 loadTemplate('guest_login', false, $content);
137 // Was an URL constructed?
139 // URL was constructed
140 if (getTotalFatalErrors() > 0) {
141 // Handle fatal errors
142 runFilterChain('handle_fatal_errors');