Kod: Tümünü seç
##############################################################
## MOD Title: Username Or Email Login Mod
## MOD Author: Johnpg82 < webmaster@theindy.net > http://www.theindy.net Code changes by bonelifer and *=Matt=* from Phpbb.com
## MOD Description: This mod allows your users to login using their email address or username
## MOD Version: 1.0.4
##
## Installation Level: Easy
## Installation Time: 3 minutes
## Files To Edit: login.php
## includes/page_header.php
## includes/functions.php
## templates/subSilver/login_body.tpl
## templates/subSilver/index_body.tpl
## language/lang_english/lang_main.php
##
##############################################################
## Author Notes:
##
## Copyright © Johnpg82, 2006-2006
##
## For any concerns please contact me at http://www.theindy.net
##
##############################################################
## This MOD is released under the GPL License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## MOD History:
##
## v1.0.4
## - Johnpg82 added email_clean function to handle email addresses longer then 25 charcters.
## added password check to sql query incase there are duplicate entries for the email address accidently.
##
## v1.0.3
## - Johnpg82 removed user_email select from the query as it was not necesary.
##
##
## v1.0.2
## - *=Matt=* made a few changes here is a direct quote See the "'" that makes the php die "Parse error: syntax error, unexpected '=' in ***" so what I did to make this work is" This was a mistake by bonelifter when doing code changes in 1.0.2
##
## v1.0.1
## - bonelifer made a few changes for better use with easymod
##
## v1.0.0
## - Initial Release
##
##############################################################
##
## Demo/Discussion Forum: http://www.phpbb.com or http://www.phpbbhacks.com
##
##
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
login.php
#
#-----[ FIND ]------------------------------------------
#
$password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password'] : '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$email = isset($HTTP_POST_VARS['username']) ? phpbb_clean_email($HTTP_POST_VARS['username']) : '';
$password_select = md5($password);
#-----[ FIND ]------------------------------------------
#
WHERE username = '" . str_replace("\\'", "''", $username) . "'";
#
#-----[ REPLACE WITH]------------------------------------------
#
WHERE user_password = '$password_select' AND username = '" . str_replace("\\'", "''", $username) . "' or user_email = '" . str_replace("\\'", "''", $email) . "'";
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
'L_USERNAME' => $lang['Username'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_USERNAME_EMAIL' => $lang['Username_Email'],
#
#-----[ OPEN ]------------------------------------------
#
includes/includes/functions.php
#
#-----[ FIND ]------------------------------------------
#
// added at phpBB 2.0.11 to properly format the username
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// added for username and email login mod to properly format the email
function phpbb_clean_email($email)
{
$email = substr(htmlspecialchars(str_replace("\'", "'", trim($email))), 0, 255);
$email = phpbb_rtrim($email, "\\");
$email = str_replace("'", "\'", $email);
return $email;
}
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
$lang['Username'] = 'Username';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['Username_Email'] = 'Username or Email Address';
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/index_body.tpl
#-----[ FIND ]------------------------------------------
#
{L_USERNAME}
#
#-----[ REPLACE WITH ]------------------------------------------
#
{L_USERNAME_EMAIL}
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/login_body.tpl
#-----[ FIND ]------------------------------------------
#
{L_USERNAME}
#
#-----[ REPLACE WITH ]------------------------------------------
#
{L_USERNAME_EMAIL}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM