<?php
/************************************************************************
- * MXChange v0.2.1 Start: 10/14/2003 *
- * =============== Last change: 04/28/2004 *
+ * Mailer v0.2.1-FINAL Start: 10/14/2003 *
+ * =================== Last change: 04/28/2004 *
* *
* -------------------------------------------------------------------- *
* File : what-login.php *
* svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
} // END - if
// Initialize variables
-$errorCode = 0;
+$errorCode = '0';
$userid = false;
$hash = '';
-$URL = '';
+$url = '';
$add = '';
// Already logged in?
if ((isMemberIdSet()) && (isSessionVariableSet('u_hash'))) {
// Maybe, then continue with it
$userid = getMemberId();
-} elseif ((isPostRequestElementSet('id')) && (isPostRequestElementSet('password')) && (isFormSent())) {
+} elseif ((isPostRequestParameterSet('id')) && (isPostRequestParameterSet('password')) && (isFormSent())) {
// Set userid and crypt password when login data was submitted
- if ((isExtensionActive('nickname')) && (isNicknameOrUserid(postRequestElement('id')))) {
+ if (isExtensionActive('nickname')) {
// Nickname entered
- $userid = SQL_ESCAPE(postRequestElement('id'));
+ $userid = SQL_ESCAPE(postRequestParameter('id'));
} else {
// Direct userid entered
- $userid = bigintval(postRequestElement('id'));
+ $userid = bigintval(postRequestParameter('id'));
}
-} elseif (isPostRequestElementSet('new_pass')) {
+} elseif (isPostRequestParameterSet('new_pass')) {
// New password requested
- $userid = 0;
- if (isPostRequestElementSet('id')) $userid = bigintval(postRequestElement('id'));
+ $userid = '0';
+ if (isPostRequestParameterSet('id')) {
+ // Do we have nickname or userid?
+ if ((isExtensionActive('nickname')) && (isNicknameUsed(postRequestParameter('id')))) {
+ // Nickname entered
+ $userid = SQL_ESCAPE(postRequestParameter('id'));
+ } else {
+ // Direct userid entered
+ $userid = bigintval(postRequestParameter('id'));
+ }
+ } // END - if
} else {
// Not logged in
- $userid = 0; $hash = '';
+ $userid = '0'; $hash = '';
}
if (isMember()) {
// Login immidiately...
- $URL = 'modules.php?module=login';
-} elseif ((isFormSent()) && ('' . $userid . '' != '' . postRequestElement('id') . '')) {
+ $url = 'modules.php?module=login';
+} elseif ((isFormSent()) && ('' . $userid . '' != '' . postRequestParameter('id') . '')) {
// Invalid input (no nickname extension installed but nickname entered)
$errorCode = getCode('EXTENSION_PROBLEM');
} elseif (isFormSent()) {
// Try the login (see inc/libs/user_functions.php)
- $URL = doUserLogin(postRequestElement('id'), postRequestElement('password'));
-} elseif ((isPostRequestElementSet('new_pass')) && (isset($userid))) {
+ $url = doUserLogin(postRequestParameter('id'), postRequestParameter('password'));
+} elseif ((isPostRequestParameterSet('new_pass')) && (isset($userid))) {
// Try the userid/email lookup (see inc/libs/user_functions.php)
- $errorCode = doNewUserPassword(postRequestElement('email'), $userid);
+ $errorCode = doNewUserPassword(postRequestParameter('email'), $userid);
}
// Login problems?
-if (isGetRequestElementSet('login')) {
+if (isGetRequestParameterSet('login')) {
// Use code from URL
- $errorCode = getRequestElement('login');
+ $errorCode = getRequestParameter('login');
} // END - if
// No problems, no output by detault
// Login problems?
if (!empty($errorCode)) {
- // @TODO Move this HTML code into a template
- $message = "<tr>
- <td width=\"10\" class=\"seperator\"> </td>
- <td colspan=\"7\" align=\"center\">
- <span class=\"guest_failed\">";
-
- // Convert the code to message
- $message .= getMessageFromErrorCode($errorCode);
+ // Do we have a userid set?
+ if (isSessionVariableSet('current_userid')) {
+ // Then prefetch data for this account
+ fetchUserData(getSession('current_userid'));
+ } // END - if
- // Continue with HTML
- $message .= "</span>
+ // @TODO Move this HTML code into a template
+ $content['message'] = '<tr>
+ <td colspan="4" align="center">
+ <span class="guest_failed">' . getMessageFromErrorCode($errorCode) . '</span>
</td>
- <td width=\"10\" class=\"seperator\"> </td>
-</tr>\n";
- $content['message'] = $message;
+</tr>';
} // END - if
// Display login form with resend-password form
}
// Was an URL constructed?
-if (!empty($URL)) {
+if (!empty($url)) {
// URL was constructed
- if (getTotalFatalErrors() > 0) {
+ if (ifFatalErrorsDetected()) {
// Handle fatal errors
runFilterChain('handle_fatal_errors');
} else {
// Load URL
- redirectToUrl($URL);
+ redirectToUrl($url);
}
} // END - if