Source for file login.php
Documentation is available at login.php
* This is the login screen
* b2evolution - {@link http://b2evolution.net/}
* Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
* @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
require_once( dirname(__FILE__
).
'/../conf/_config.php' );
require_once( dirname(__FILE__
).
"/
$htsrv_dirout/
$core_subdir/_main.php
" );
param( 'action', 'string', '' );
param( 'mode', 'string', '' );
param( 'text', 'html', '' );
param( 'popupurl', 'string', '' );
param( 'popuptitle', 'string', '' );
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " .
gmdate("D, d M Y H:i:s") .
" GMT");
header("Cache-Control: no-cache, must-revalidate"); // for HTTP/1.1
param( 'redirect_to', 'string', $_SERVER['HTTP_REFERER'] );
$location =
empty($redirect_to) ?
$baseurl.
'/' :
$redirect_to;
param( 'redirect_to', 'string', $admin_url.
'/b2edit.php' );
// Display retrieval form:
require
( dirname(__FILE__
).
'/_lostpass_form.php' );
break; // case 'lostpassword'
* Retrieve lost password:
param( 'log', 'string', true );
param( 'redirect_to', 'string', $admin_url.
'/b2edit.php' );
if( $demo_mode &&
($log ==
'demouser' ||
$log ==
'admin') )
$notes =
T_('You cannot reset this account in demo mode.').
"<br />\n";
$user_email =
$user_data['user_email'];
// echo 'email: ', $user_email;
// echo 'locale: '.$user_data['locale'];
{ // pretend that the email is sent for avoiding guessing user_login
$notes =
T_('An email with the new password was sent successfully to your email address.').
"<br />\n";
$message =
T_('Login:').
" $log\r\n";
$message .=
T_('New Password:').
" $random_password\r\n";
$message .=
"\r\n".
T_('You can login here:').
"\r\n".
$admin_url.
"/\r\n";
// echo $message.' (password not set yet, only when sending email does not fail);
if( !send_mail( $user_email, T_('your weblog\'s login/password'), $message, $notify_from ) )
$notes =
T_('The email could not be sent.').
"<br />\n"
.
T_('Possible reason: your host may have disabled the mail() function...');
$DB->query( "UPDATE $tableusers
SET user_pass = '" .
md5($random_password) .
"'
WHERE user_login = '$log'" );
$notes =
T_('An email with the new password was sent successfully to your email address.').
"<br />\n";
{ // The user is already logged in...
// TODO: use $login_error to be clear
$error =
is_string($error) ?
$error.
'<br />' :
'';
$error .=
T_('Note: You are already logged in!');
// Note: if $redirect_to is already set, param() will not touch it.
param( 'redirect_to', 'string', $ReqURI );
if( strstr( $redirect_to, 'login.php' ) )
{ // avoid "endless loops"
$redirect_to =
$admin_url.
'/';
$error .=
' <a href="'.
$redirect_to.
'">'.
T_('Continue...').
'</a>';
require
( dirname(__FILE__
).
'/_login_form.php' );