Vergleich member.php - 1.6.8 - 1.6.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: member.php 5784 2012-04-19 12:57:48Z Tomm $

 * $Id$

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

Zeile 14Zeile 14
define("ALLOWABLE_PAGE", "register,do_register,login,do_login,logout,lostpw,do_lostpw,activate,resendactivation,do_resendactivation,resetpassword");

$nosession['avatar'] = 1;

define("ALLOWABLE_PAGE", "register,do_register,login,do_login,logout,lostpw,do_lostpw,activate,resendactivation,do_resendactivation,resetpassword");

$nosession['avatar'] = 1;

$templatelist = "member_register,error_nousername,error_nopassword,error_passwordmismatch,error_invalidemail,error_usernametaken,error_emailmismatch,error_noemail,redirect_registered,member_register_hiddencaptcha";
$templatelist .= ",redirect_loggedout,login,redirect_loggedin,error_invalidusername,error_invalidpassword,member_profile_email,member_profile_offline,member_profile_reputation,member_profile_warn,member_profile_warninglevel,member_profile_customfields_field,member_profile_customfields,member_profile_adminoptions,member_profile,member_login,member_profile_online,member_profile_modoptions,member_profile_signature,member_profile_groupimage,member_profile_referrals";


$templatelist = "member_register,member_register_hiddencaptcha,member_coppa_form,member_register_coppa,member_register_agreement_coppa,member_register_agreement,usercp_options_tppselect,usercp_options_pppselect,member_register_referrer,member_register_customfield,member_register_requiredfields,member_register_password,member_activate,member_resendactivation,member_lostpw";
$templatelist .= ",member_resetpassword,member_loggedin_notice,member_profile_away,member_emailuser,member_register_regimage,member_register_regimage_recaptcha,post_captcha_hidden,post_captcha,post_captcha_recaptcha";
$templatelist .= ",member_profile_email,member_profile_offline,member_profile_reputation,member_profile_warn,member_profile_warninglevel,member_profile_customfields_field,member_profile_customfields,member_profile_adminoptions,member_profile,member_login,member_profile_online,member_profile_modoptions,member_profile_signature,member_profile_groupimage,member_profile_referrals";

require_once "./global.php";

require_once MYBB_ROOT."inc/functions_post.php";

require_once "./global.php";

require_once MYBB_ROOT."inc/functions_post.php";

Zeile 126Zeile 127
		"regip" => $session->ipaddress,
"longregip" => my_ip2long($session->ipaddress),
"coppa_user" => intval($mybb->cookies['coppauser']),

		"regip" => $session->ipaddress,
"longregip" => my_ip2long($session->ipaddress),
"coppa_user" => intval($mybb->cookies['coppauser']),

 
		"regcheck1" => $mybb->input['regcheck1'],
"regcheck2" => $mybb->input['regcheck2']

	);

	);

	
if(isset($mybb->input['regcheck1']) && isset($mybb->input['regcheck2']))
{
$user['regcheck1'] = $mybb->input['regcheck1'];
$user['regcheck2'] = $mybb->input['regcheck2'];
}

 

// Do we have a saved COPPA DOB?
if($mybb->cookies['coppadob'])


// Do we have a saved COPPA DOB?
if($mybb->cookies['coppadob'])

Zeile 161Zeile 158
	$errors = "";

if(!$userhandler->validate_user())

	$errors = "";

if(!$userhandler->validate_user())

	{

	{

		$errors = $userhandler->get_friendly_errors();
}


		$errors = $userhandler->get_friendly_errors();
}


Zeile 218Zeile 215
		if($mybb->input['pmnotice'] == 1)
{
$pmnoticecheck = " checked=\"checked\"";

		if($mybb->input['pmnotice'] == 1)
{
$pmnoticecheck = " checked=\"checked\"";

		}

		}


if($mybb->input['emailpmnotify'] == 1)


if($mybb->input['emailpmnotify'] == 1)

		{

		{

			$emailpmnotifycheck = "checked=\"checked\"";

			$emailpmnotifycheck = "checked=\"checked\"";

		}


		}


		if($mybb->input['invisible'] == 1)
{
$invisiblecheck = "checked=\"checked\"";

		if($mybb->input['invisible'] == 1)
{
$invisiblecheck = "checked=\"checked\"";

		}

		}


if($mybb->input['dstcorrection'] == 2)


if($mybb->input['dstcorrection'] == 2)

		{

		{

			$dst_auto_selected = "selected=\"selected\"";
}
else if($mybb->input['dstcorrection'] == 1)

			$dst_auto_selected = "selected=\"selected\"";
}
else if($mybb->input['dstcorrection'] == 1)

		{

		{

			$dst_enabled_selected = "selected=\"selected\"";
}
else

			$dst_enabled_selected = "selected=\"selected\"";
}
else

Zeile 246Zeile 243
		$regerrors = inline_error($errors);
$mybb->input['action'] = "register";
$fromreg = 1;

		$regerrors = inline_error($errors);
$mybb->input['action'] = "register";
$fromreg = 1;

	}

	}

	else
{
$user_info = $userhandler->insert_user();

	else
{
$user_info = $userhandler->insert_user();

Zeile 331Zeile 328
			$plugins->run_hooks("member_do_register_end");

error($lang->redirect_registered_admin_activate);

			$plugins->run_hooks("member_do_register_end");

error($lang->redirect_registered_admin_activate);

		}

		}

		else
{
$lang->redirect_registered = $lang->sprintf($lang->redirect_registered, $mybb->settings['bbname'], $user_info['username']);

		else
{
$lang->redirect_registered = $lang->sprintf($lang->redirect_registered, $mybb->settings['bbname'], $user_info['username']);





			$plugins->run_hooks("member_do_register_end");

redirect("index.php", $lang->redirect_registered);
}

			$plugins->run_hooks("member_do_register_end");

redirect("index.php", $lang->redirect_registered);
}

	}
}


	}
}


if($mybb->input['action'] == "coppa_form")
{
if(!$mybb->settings['faxno'])

if($mybb->input['action'] == "coppa_form")
{
if(!$mybb->settings['faxno'])

Zeile 360Zeile 357
	if($mybb->settings['coppa'] == "disabled")
{
$bdaysel = $bday2blank = "<option value=\"\">&nbsp;</option>";

	if($mybb->settings['coppa'] == "disabled")
{
$bdaysel = $bday2blank = "<option value=\"\">&nbsp;</option>";

	}

	}

	for($i = 1; $i <= 31; ++$i)
{
if($mybb->input['bday1'] == $i)

	for($i = 1; $i <= 31; ++$i)
{
if($mybb->input['bday1'] == $i)

Zeile 418Zeile 415
		if($mybb->settings['coppa'] != "disabled" && ($mybb->cookies['coppauser'] == 1 || $under_thirteen))
{
if($mybb->settings['coppa'] == "deny")

		if($mybb->settings['coppa'] != "disabled" && ($mybb->cookies['coppauser'] == 1 || $under_thirteen))
{
if($mybb->settings['coppa'] == "deny")

			{

			{

				error($lang->error_need_to_be_thirteen);
}
$lang->coppa_agreement_1 = $lang->sprintf($lang->coppa_agreement_1, $mybb->settings['bbname']);
eval("\$coppa_agreement = \"".$templates->get("member_register_agreement_coppa")."\";");

				error($lang->error_need_to_be_thirteen);
}
$lang->coppa_agreement_1 = $lang->sprintf($lang->coppa_agreement_1, $mybb->settings['bbname']);
eval("\$coppa_agreement = \"".$templates->get("member_register_agreement_coppa")."\";");

		}

$plugins->run_hooks("member_register_agreement");


		}

$plugins->run_hooks("member_register_agreement");


		eval("\$agreement = \"".$templates->get("member_register_agreement")."\";");
output_page($agreement);
}

		eval("\$agreement = \"".$templates->get("member_register_agreement")."\";");
output_page($agreement);
}

Zeile 437Zeile 434
		$validator_extra = '';

if(isset($mybb->input['timezoneoffset']))

		$validator_extra = '';

if(isset($mybb->input['timezoneoffset']))

		{

		{

			$timezoneoffset = $mybb->input['timezoneoffset'];
}
else

			$timezoneoffset = $mybb->input['timezoneoffset'];
}
else

Zeile 447Zeile 444
		$tzselect = build_timezone_select("timezoneoffset", $timezoneoffset, true);

$stylelist = build_theme_select("style");

		$tzselect = build_timezone_select("timezoneoffset", $timezoneoffset, true);

$stylelist = build_theme_select("style");





		if($mybb->settings['usertppoptions'])
{
$tppoptions = '';

		if($mybb->settings['usertppoptions'])
{
$tppoptions = '';

Zeile 534Zeile 531
			else
{
$userfield = '';

			else
{
$userfield = '';

			}

			}

			if($type == "multiselect")
{
if($errors)
{
$useropts = $userfield;

			if($type == "multiselect")
{
if($errors)
{
$useropts = $userfield;

				}

				}

				else
{
$useropts = explode("\n", $userfield);

				else
{
$useropts = explode("\n", $userfield);

				}

				}

				if(is_array($useropts))
{
foreach($useropts as $key => $val)

				if(is_array($useropts))
{
foreach($useropts as $key => $val)

Zeile 562Zeile 559

$sel = "";
if($val == $seloptions[$val])


$sel = "";
if($val == $seloptions[$val])

						{
$sel = "selected=\"selected\"";

						{
$sel = "selected=\"selected\"";

						}
$select .= "<option value=\"$val\" $sel>$val</option>\n";

						}
$select .= "<option value=\"$val\" $sel>$val</option>\n";

					}
if(!$profilefield['length'])

					}
if(!$profilefield['length'])

					{
$profilefield['length'] = 3;

					{
$profilefield['length'] = 3;

					}

					}

					$code = "<select name=\"profile_fields[$field][]\" id=\"{$field}\" size=\"{$profilefield['length']}\" multiple=\"multiple\">$select</select>";
}
}

					$code = "<select name=\"profile_fields[$field][]\" id=\"{$field}\" size=\"{$profilefield['length']}\" multiple=\"multiple\">$select</select>";
}
}

Zeile 591Zeile 588
						$select .= "<option value=\"$val\" $sel>$val</option>";
}
if(!$profilefield['length'])

						$select .= "<option value=\"$val\" $sel>$val</option>";
}
if(!$profilefield['length'])

					{

					{

						$profilefield['length'] = 1;
}
$code = "<select name=\"profile_fields[$field]\" id=\"{$field}\" size=\"{$profilefield['length']}\">$select</select>";

						$profilefield['length'] = 1;
}
$code = "<select name=\"profile_fields[$field]\" id=\"{$field}\" size=\"{$profilefield['length']}\">$select</select>";

Zeile 601Zeile 598
			{
$expoptions = explode("\n", $options);
if(is_array($expoptions))

			{
$expoptions = explode("\n", $options);
if(is_array($expoptions))

				{

				{

					foreach($expoptions as $key => $val)
{
$checked = "";

					foreach($expoptions as $key => $val)
{
$checked = "";

Zeile 611Zeile 608
						}
$code .= "<input type=\"radio\" class=\"radio\" name=\"profile_fields[$field]\" id=\"{$field}{$key}\" value=\"$val\" $checked /> <span class=\"smalltext\">$val</span><br />";
}

						}
$code .= "<input type=\"radio\" class=\"radio\" name=\"profile_fields[$field]\" id=\"{$field}{$key}\" value=\"$val\" $checked /> <span class=\"smalltext\">$val</span><br />";
}

				}

				}

			}
elseif($type == "checkbox")
{
if($errors)
{
$useropts = $userfield;

			}
elseif($type == "checkbox")
{
if($errors)
{
$useropts = $userfield;

				}
else
{

				}
else
{

					$useropts = explode("\n", $userfield);
}
if(is_array($useropts))

					$useropts = explode("\n", $userfield);
}
if(is_array($useropts))

				{

				{

					foreach($useropts as $key => $val)
{
$seloptions[$val] = $val;

					foreach($useropts as $key => $val)
{
$seloptions[$val] = $val;

					}

					}

				}
$expoptions = explode("\n", $options);
if(is_array($expoptions))

				}
$expoptions = explode("\n", $options);
if(is_array($expoptions))

Zeile 648Zeile 645
			{
$value = htmlspecialchars_uni($userfield);
$code = "<textarea name=\"profile_fields[$field]\" id=\"{$field}\" rows=\"6\" cols=\"30\" style=\"width: 95%\">$value</textarea>";

			{
$value = htmlspecialchars_uni($userfield);
$code = "<textarea name=\"profile_fields[$field]\" id=\"{$field}\" rows=\"6\" cols=\"30\" style=\"width: 95%\">$value</textarea>";

			}
else

			}
else

			{
$value = htmlspecialchars_uni($userfield);
$maxlength = "";

			{
$value = htmlspecialchars_uni($userfield);
$maxlength = "";

Zeile 736Zeile 733
			{
$lang->password = $lang->complex_password = $lang->sprintf($lang->complex_password, $mybb->settings['minpasswordlength']);
$validator_extra .= "\tregValidator.register('password', 'ajax', {url:'xmlhttp.php?action=complex_password', loading_message:'{$lang->js_validator_password_complexity}'});\n";

			{
$lang->password = $lang->complex_password = $lang->sprintf($lang->complex_password, $mybb->settings['minpasswordlength']);
$validator_extra .= "\tregValidator.register('password', 'ajax', {url:'xmlhttp.php?action=complex_password', loading_message:'{$lang->js_validator_password_complexity}'});\n";

			}

			}

			$validator_extra .= "\tregValidator.register('password2', 'matches', {match_field:'password', status_field:'password_status', failure_message:'{$lang->js_validator_password_matches}'});\n";

eval("\$passboxes = \"".$templates->get("member_register_password")."\";");

			$validator_extra .= "\tregValidator.register('password2', 'matches', {match_field:'password', status_field:'password_status', failure_message:'{$lang->js_validator_password_matches}'});\n";

eval("\$passboxes = \"".$templates->get("member_register_password")."\";");

		}

		}


// JS validator extra
if($mybb->settings['maxnamelength'] > 0 && $mybb->settings['minnamelength'] > 0)


// JS validator extra
if($mybb->settings['maxnamelength'] > 0 && $mybb->settings['minnamelength'] > 0)

		{

		{

			$lang->js_validator_username_length = $lang->sprintf($lang->js_validator_username_length, $mybb->settings['minnamelength'], $mybb->settings['maxnamelength']);
$validator_extra .= "\tregValidator.register('username', 'length', {min: {$mybb->settings['minnamelength']}, max: {$mybb->settings['maxnamelength']}, failure_message:'{$lang->js_validator_username_length}'});\n";

			$lang->js_validator_username_length = $lang->sprintf($lang->js_validator_username_length, $mybb->settings['minnamelength'], $mybb->settings['maxnamelength']);
$validator_extra .= "\tregValidator.register('username', 'length', {min: {$mybb->settings['minnamelength']}, max: {$mybb->settings['maxnamelength']}, failure_message:'{$lang->js_validator_username_length}'});\n";

		}

		}


$languages = $lang->get_languages();
$langoptions = '';


$languages = $lang->get_languages();
$langoptions = '';

Zeile 755Zeile 752
		{
$language = htmlspecialchars_uni($language);
if($user['language'] == $lname)

		{
$language = htmlspecialchars_uni($language);
if($user['language'] == $lname)

			{

			{

				$langoptions .= "<option value=\"$lname\" selected=\"selected\">$language</option>\n";
}
else

				$langoptions .= "<option value=\"$lname\" selected=\"selected\">$language</option>\n";
}
else

Zeile 765Zeile 762
		}

$plugins->run_hooks("member_register_end");

		}

$plugins->run_hooks("member_register_end");





		eval("\$registration = \"".$templates->get("member_register")."\";");
output_page($registration);
}

		eval("\$registration = \"".$templates->get("member_register")."\";");
output_page($registration);
}

Zeile 822Zeile 819
	{
$mybb->settings['awaitingusergroup'] = "5";
$query = $db->simple_select("awaitingactivation", "*", "uid='".$user['uid']."' AND (type='r' OR type='e')");

	{
$mybb->settings['awaitingusergroup'] = "5";
$query = $db->simple_select("awaitingactivation", "*", "uid='".$user['uid']."' AND (type='r' OR type='e')");

		$activation = $db->fetch_array($query);

		$activation = $db->fetch_array($query);

		if(!$activation['uid'])
{
error($lang->error_alreadyactivated);

		if(!$activation['uid'])
{
error($lang->error_alreadyactivated);

Zeile 964Zeile 961
	if($numusers < 1)
{
error($lang->error_invalidemail);

	if($numusers < 1)
{
error($lang->error_invalidemail);

	}
else

	}
else

	{
while($user = $db->fetch_array($query))
{

	{
while($user = $db->fetch_array($query))
{

Zeile 1051Zeile 1048
	else
{
$query = $db->simple_select("users", "*", "uid='".intval($mybb->input['uid'])."'");

	else
{
$query = $db->simple_select("users", "*", "uid='".intval($mybb->input['uid'])."'");

		$user = $db->fetch_array($query);
}

		$user = $db->fetch_array($query);
}

	if($mybb->input['code'] && $user['uid'])
{
$query = $db->simple_select("awaitingactivation", "*", "uid='".$user['uid']."' AND type='p'");
$activation = $db->fetch_array($query);
$now = TIME_NOW;
if($activation['code'] != $mybb->input['code'])

	if($mybb->input['code'] && $user['uid'])
{
$query = $db->simple_select("awaitingactivation", "*", "uid='".$user['uid']."' AND type='p'");
$activation = $db->fetch_array($query);
$now = TIME_NOW;
if($activation['code'] != $mybb->input['code'])

		{

		{

			error($lang->error_badlostpwcode);
}
$db->delete_query("awaitingactivation", "uid='".$user['uid']."' AND type='p'");

			error($lang->error_badlostpwcode);
}
$db->delete_query("awaitingactivation", "uid='".$user['uid']."' AND type='p'");

Zeile 1072Zeile 1069
		{
$password_length = 8;
}

		{
$password_length = 8;
}





		$password = random_str($password_length);
$logindetails = update_password($user['uid'], md5($password), $user['salt']);

		$password = random_str($password_length);
$logindetails = update_password($user['uid'], md5($password), $user['salt']);





		$email = $user['email'];

		$email = $user['email'];





		$plugins->run_hooks("member_resetpassword_process");

		$plugins->run_hooks("member_resetpassword_process");





		$emailsubject = $lang->sprintf($lang->emailsubject_passwordreset, $mybb->settings['bbname']);
$emailmessage = $lang->sprintf($lang->email_passwordreset, $username, $mybb->settings['bbname'], $password);
my_mail($email, $emailsubject, $emailmessage);

$plugins->run_hooks("member_resetpassword_reset");

		$emailsubject = $lang->sprintf($lang->emailsubject_passwordreset, $mybb->settings['bbname']);
$emailmessage = $lang->sprintf($lang->email_passwordreset, $username, $mybb->settings['bbname'], $password);
my_mail($email, $emailsubject, $emailmessage);

$plugins->run_hooks("member_resetpassword_reset");





		error($lang->redirect_passwordreset);
}
else

		error($lang->redirect_passwordreset);
}
else

Zeile 1095Zeile 1092
		switch($mybb->settings['username_method'])
{
case 0:

		switch($mybb->settings['username_method'])
{
case 0:

				$lang_username = $lang->username;

				$lang_username = $lang->username;

				break;
case 1:
$lang_username = $lang->username1;

				break;
case 1:
$lang_username = $lang->username1;

Zeile 1105Zeile 1102
				break;
default:
$lang_username = $lang->username;

				break;
default:
$lang_username = $lang->username;

				break;
}


				break;
}


		eval("\$activate = \"".$templates->get("member_resetpassword")."\";");
output_page($activate);
}
}


		eval("\$activate = \"".$templates->get("member_resetpassword")."\";");
output_page($activate);
}
}


$do_captcha = $correct = false;
$inline_errors = "";

$correct = false;
$inline_errors = '';

if($mybb->input['action'] == "do_login" && $mybb->request_method == "post")
{
$plugins->run_hooks("member_do_login_start");

if($mybb->input['action'] == "do_login" && $mybb->request_method == "post")
{
$plugins->run_hooks("member_do_login_start");

	



	// Checks to make sure the user can login; they haven't had too many tries at logging in.
// Is a fatal call if user has had too many tries
$logins = login_attempt_check();
$login_text = '';

	// Checks to make sure the user can login; they haven't had too many tries at logging in.
// Is a fatal call if user has had too many tries
$logins = login_attempt_check();
$login_text = '';

	



	// Did we come from the quick login form
if($mybb->input['quick_login'] == "1" && $mybb->input['quick_password'] && $mybb->input['quick_username'])
{

	// Did we come from the quick login form
if($mybb->input['quick_login'] == "1" && $mybb->input['quick_password'] && $mybb->input['quick_username'])
{

Zeile 1138Zeile 1135
		switch($mybb->settings['username_method'])
{
case 0:

		switch($mybb->settings['username_method'])
{
case 0:

				error($lang->error_invalidpworusername.$login_text);
break;
case 1:
error($lang->error_invalidpworusername1.$login_text);
break;
case 2:
error($lang->error_invalidpworusername2.$login_text);
break;
default:
error($lang->error_invalidpworusername.$login_text);
break;
}
}

$query = $db->simple_select("users", "loginattempts", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['username']))."' OR LOWER(email)='".$db->escape_string(my_strtolower($mybb->input['username']))."'", array('limit' => 1));
$loginattempts = $db->fetch_field($query, "loginattempts");

$errors = array();

$user = validate_password_from_username($mybb->input['username'], $mybb->input['password']);
if(!$user['uid'])
{
my_setcookie('loginattempts', $logins + 1);
$db->update_query("users", array('loginattempts' => 'loginattempts+1'), "LOWER(username) = '".$db->escape_string(my_strtolower($mybb->input['username']))."'", 1, true);

$mybb->input['action'] = "login";
$mybb->input['request_method'] = "get";

if($mybb->settings['failedlogincount'] != 0 && $mybb->settings['failedlogintext'] == 1)
{
$login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);
}

switch($mybb->settings['username_method'])
{
case 0:
$errors[] = $lang->error_invalidpworusername.$login_text;

				error($lang->error_invalidpworusername.$login_text);





































				break;
case 1:

				break;
case 1:

				$errors[] = $lang->error_invalidpworusername1.$login_text;

				error($lang->error_invalidpworusername1.$login_text);

				break;
case 2:

				break;
case 2:

				$errors[] = $lang->error_invalidpworusername2.$login_text;

				error($lang->error_invalidpworusername2.$login_text);

				break;
default:

				break;
default:

				$errors[] = $lang->error_invalidpworusername.$login_text;

				error($lang->error_invalidpworusername.$login_text);

				break;
}
}

				break;
}
}

	else
{
$correct = true;
}




$query = $db->simple_select("users", "loginattempts", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['username']))."' OR LOWER(email)='".$db->escape_string(my_strtolower($mybb->input['username']))."'", array('limit' => 1));
$loginattempts = $db->fetch_field($query, "loginattempts");

$errors = array();


	if($mybb->settings['failedcaptchalogincount'] > 0 && ($loginattempts > $mybb->settings['failedcaptchalogincount'] || intval($mybb->cookies['loginattempts']) > $mybb->settings['failedcaptchalogincount']))

	if($mybb->settings['failedcaptchalogincount'] > 0 && ($loginattempts > $mybb->settings['failedcaptchalogincount'] || intval($mybb->cookies['loginattempts']) > $mybb->settings['failedcaptchalogincount']))

	{		

	{

		// Show captcha image if enabled

		// Show captcha image if enabled

		if($mybb->settings['captchaimage'] == 1 && function_exists("imagepng"))
{
// Check their current captcha input - if correct, hide the captcha input area
if($mybb->input['imagestring'])
{
$imagehash = $db->escape_string($mybb->input['imagehash']);
$imagestring = $db->escape_string($mybb->input['imagestring']);
$query = $db->simple_select("captcha", "*", "imagehash='{$imagehash}' AND imagestring='{$imagestring}'");
$imgcheck = $db->fetch_array($query);
if($imgcheck['dateline'] > 0)






		if($mybb->settings['captchaimage'])
{
$do_captcha = false;

// Check their current captcha input - if correct, hide the captcha input area
require_once MYBB_ROOT.'inc/class_captcha.php';
$login_captcha = new captcha;

if($login_captcha->validate_captcha() == false)
{
$correct = true;
$do_captcha = true;

// CAPTCHA validation failed
foreach($login_captcha->get_errors() as $error)

				{

				{

					$correct = true;

					$errors[] = $error;

				}

				}

				else
{
$db->delete_query("captcha", "imagehash='{$imagehash}'");
$errors[] = $lang->error_regimageinvalid;
}
}
else if($mybb->input['quick_login'] == 1 && $mybb->input['quick_password'] && $mybb->input['quick_username'])
















			}
}
}

// Don't check password when captcha isn't solved
if(empty($errors))
{
$user = validate_password_from_username($mybb->input['username'], $mybb->input['password']);
if(!$user['uid'])
{
my_setcookie('loginattempts', $logins + 1);
$db->update_query("users", array('loginattempts' => 'loginattempts+1'), "LOWER(username) = '".$db->escape_string(my_strtolower($mybb->input['username']))."'", 1, true);

$mybb->input['action'] = "login";
$mybb->input['request_method'] = "get";

if($mybb->settings['failedlogincount'] != 0 && $mybb->settings['failedlogintext'] == 1)
{
$login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);
}

switch($mybb->settings['username_method'])

			{

			{

				$errors[] = $lang->error_regimagerequired;












				case 0:
$errors[] = $lang->error_invalidpworusername.$login_text;
break;
case 1:
$errors[] = $lang->error_invalidpworusername1.$login_text;
break;
case 2:
$errors[] = $lang->error_invalidpworusername2.$login_text;
break;
default:
$errors[] = $lang->error_invalidpworusername.$login_text;
break;

			}

			}

			else
{
$errors[] = $lang->error_regimagerequired;
}
}

$do_captcha = true;
}


		}
else
{
$correct = true;
}
}




	if(!empty($errors))
{
$mybb->input['action'] = "login";

	if(!empty($errors))
{
$mybb->input['action'] = "login";

Zeile 1240Zeile 1231
		{
error($lang->error_awaitingcoppa);
}

		{
error($lang->error_awaitingcoppa);
}

		

		

		my_setcookie('loginattempts', 1);
$db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."' AND sid != '".$session->sid."'");
$newsession = array(
"uid" => $user['uid'],
);
$db->update_query("sessions", $newsession, "sid='".$session->sid."'");

		my_setcookie('loginattempts', 1);
$db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."' AND sid != '".$session->sid."'");
$newsession = array(
"uid" => $user['uid'],
);
$db->update_query("sessions", $newsession, "sid='".$session->sid."'");

		

		

		$db->update_query("users", array("loginattempts" => 1), "uid='{$user['uid']}'");

if($mybb->input['remember'] != "yes")

		$db->update_query("users", array("loginattempts" => 1), "uid='{$user['uid']}'");

if($mybb->input['remember'] != "yes")

		{

		{

			$remember = -1;

			$remember = -1;

		}
else

		}
else

		{
$remember = null;

		{
$remember = null;

		}

		}

		my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], $remember, true);
my_setcookie("sid", $session->sid, -1, true);

		my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], $remember, true);
my_setcookie("sid", $session->sid, -1, true);

		



		$plugins->run_hooks("member_do_login_end");

		$plugins->run_hooks("member_do_login_end");

		



		if($mybb->input['url'] != "" && my_strpos(basename($mybb->input['url']), 'member.php') === false)

		if($mybb->input['url'] != "" && my_strpos(basename($mybb->input['url']), 'member.php') === false)

		{

		{

			if((my_strpos(basename($mybb->input['url']), 'newthread.php') !== false || my_strpos(basename($mybb->input['url']), 'newreply.php') !== false) && my_strpos($mybb->input['url'], '&processed=1') !== false)
{
$mybb->input['url'] = str_replace('&processed=1', '', $mybb->input['url']);

			if((my_strpos(basename($mybb->input['url']), 'newthread.php') !== false || my_strpos(basename($mybb->input['url']), 'newreply.php') !== false) && my_strpos($mybb->input['url'], '&processed=1') !== false)
{
$mybb->input['url'] = str_replace('&processed=1', '', $mybb->input['url']);

Zeile 1279Zeile 1270
		{
redirect("index.php", $lang->redirect_loggedin);
}

		{
redirect("index.php", $lang->redirect_loggedin);
}

	}

	}

	else
{
$mybb->input['action'] = "login";
$mybb->input['request_method'] = "get";
}

	else
{
$mybb->input['action'] = "login";
$mybb->input['request_method'] = "get";
}

	



	$plugins->run_hooks("member_do_login_end");
}

if($mybb->input['action'] == "login")
{
$plugins->run_hooks("member_login");

	$plugins->run_hooks("member_do_login_end");
}

if($mybb->input['action'] == "login")
{
$plugins->run_hooks("member_login");

	



	$member_loggedin_notice = "";
if($mybb->user['uid'] != 0)
{

	$member_loggedin_notice = "";
if($mybb->user['uid'] != 0)
{

Zeile 1305Zeile 1296
	login_attempt_check();

// Redirect to the page where the user came from, but not if that was the login page.

	login_attempt_check();

// Redirect to the page where the user came from, but not if that was the login page.

 
	$redirect_url = '';

	if($_SERVER['HTTP_REFERER'] && strpos($_SERVER['HTTP_REFERER'], "action=login") === false)
{
$redirect_url = htmlentities($_SERVER['HTTP_REFERER']);

	if($_SERVER['HTTP_REFERER'] && strpos($_SERVER['HTTP_REFERER'], "action=login") === false)
{
$redirect_url = htmlentities($_SERVER['HTTP_REFERER']);

	}
else




	}

$captcha = '';
// Show captcha image for guests if enabled and only if we have to do
if($mybb->settings['captchaimage'] && isset($do_captcha))

	{

	{

		$redirect_url = '';






































		$correct = false;
require_once MYBB_ROOT.'inc/class_captcha.php';
$login_captcha = new captcha(false, "post_captcha");

if($do_captcha == false && $login_captcha->type == 1)
{
if($login_captcha->validate_captcha() == true)
{
$correct = true;
$captcha = $login_captcha->build_hidden_captcha();
}
}

if(!$correct)
{
if($login_captcha->type == 1)
{
$login_captcha->build_captcha();
}
elseif($login_captcha->type == 2)
{
$login_captcha->build_recaptcha();
}

if($login_captcha->html)
{
$captcha = $login_captcha->html;
}
}
elseif($correct && $login_captcha->type == 2)
{
$login_captcha->build_recaptcha();

if($login_captcha->html)
{
$captcha = $login_captcha->html;
}
}

	}


	}


	$captcha = "";
// Show captcha image for guests if enabled
if($mybb->settings['captchaimage'] == 1 && function_exists("imagepng") && $do_captcha == true)
{
$randomstr = random_str(5);
$imagehash = md5(random_str(12));
$imagearray = array(
"imagehash" => $imagehash,
"imagestring" => $randomstr,
"dateline" => TIME_NOW
);
$db->insert_query("captcha", $imagearray);
eval("\$captcha = \"".$templates->get("post_captcha")."\";");
}


 
	$username = "";
$password = "";
if($mybb->input['username'] && $mybb->request_method == "post")

	$username = "";
$password = "";
if($mybb->input['username'] && $mybb->request_method == "post")

Zeile 1379Zeile 1396
	my_unsetcookie("mybbuser");
my_unsetcookie("sid");
if($mybb->user['uid'])

	my_unsetcookie("mybbuser");
my_unsetcookie("sid");
if($mybb->user['uid'])

	{

	{

		$time = TIME_NOW;
$lastvisit = array(
"lastactive" => $time-900,

		$time = TIME_NOW;
$lastvisit = array(
"lastactive" => $time-900,

Zeile 1435Zeile 1452
			$query = $db->simple_select("posts", "uid", "tid='$tid' AND visible = 1", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => '1'));
$post = $db->fetch_array($query);
$uid = $post['uid'];

			$query = $db->simple_select("posts", "uid", "tid='$tid' AND visible = 1", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => '1'));
$post = $db->fetch_array($query);
$uid = $post['uid'];

		}
}
else

		}
}
else

	{
if($mybb->input['uid'])
{

	{
if($mybb->input['uid'])
{

Zeile 1527Zeile 1544
		$bgcolors[$cat] = alt_trow();
}


		$bgcolors[$cat] = alt_trow();
}


 
	$website = '';

	if($memprofile['website'])
{
$memprofile['website'] = htmlspecialchars_uni($memprofile['website']);
$website = "<a href=\"{$memprofile['website']}\" target=\"_blank\">{$memprofile['website']}</a>";

	if($memprofile['website'])
{
$memprofile['website'] = htmlspecialchars_uni($memprofile['website']);
$website = "<a href=\"{$memprofile['website']}\" target=\"_blank\">{$memprofile['website']}</a>";

	}
else
{
$website = '';

 
	}


	}


 
	$signature = '';

	if($memprofile['signature'] && ($memprofile['suspendsignature'] == 0 || $memprofile['suspendsigtime'] < TIME_NOW))
{
$sig_parser = array(

	if($memprofile['signature'] && ($memprofile['suspendsignature'] == 0 || $memprofile['suspendsigtime'] < TIME_NOW))
{
$sig_parser = array(

Zeile 1550Zeile 1565

$memprofile['signature'] = $parser->parse_message($memprofile['signature'], $sig_parser);
eval("\$signature = \"".$templates->get("member_profile_signature")."\";");


$memprofile['signature'] = $parser->parse_message($memprofile['signature'], $sig_parser);
eval("\$signature = \"".$templates->get("member_profile_signature")."\";");

	}

$daysreg = (TIME_NOW - $memprofile['regdate']) / (24*3600);


	}

$daysreg = (TIME_NOW - $memprofile['regdate']) / (24*3600);


	if($daysreg < 1)
{
$daysreg = 1;

	if($daysreg < 1)
{
$daysreg = 1;

Zeile 1591Zeile 1606
		$memprofile['icq'] = '';
}


		$memprofile['icq'] = '';
}


 
	$awaybit = '';

	if($memprofile['away'] == 1 && $mybb->settings['allowaway'] != 0)
{
$lang->away_note = $lang->sprintf($lang->away_note, $memprofile['username']);

	if($memprofile['away'] == 1 && $mybb->settings['allowaway'] != 0)
{
$lang->away_note = $lang->sprintf($lang->away_note, $memprofile['username']);

Zeile 1741Zeile 1757
	// Get the user title for this user
unset($usertitle);
unset($stars);

	// Get the user title for this user
unset($usertitle);
unset($stars);

 
	$starimage = '';

	if(trim($memprofile['usertitle']) != '')
{
// User has custom user title

	if(trim($memprofile['usertitle']) != '')
{
// User has custom user title

Zeile 1799Zeile 1816
		}
}


		}
}


 
	$groupimage = '';

	if(!empty($displaygroup['image']))
{
if(!empty($mybb->user['language']))

	if(!empty($displaygroup['image']))
{
if(!empty($mybb->user['language']))

Zeile 1814Zeile 1832
		eval("\$groupimage = \"".$templates->get("member_profile_groupimage")."\";");
}


		eval("\$groupimage = \"".$templates->get("member_profile_groupimage")."\";");
}


	if(!$starimage)

	if(empty($starimage))

	{
$starimage = $displaygroup['starimage'];
}


	{
$starimage = $displaygroup['starimage'];
}


	if($starimage)

	if(!empty($starimage))

	{
// Only display stars if we have an image to use...
$starimage = str_replace("{theme}", $theme['imgdir'], $starimage);

	{
// Only display stars if we have an image to use...
$starimage = str_replace("{theme}", $theme['imgdir'], $starimage);

Zeile 1873Zeile 1891
		$reputation = get_reputation($memprofile['reputation']);

// If this user has permission to give reputations show the vote link

		$reputation = get_reputation($memprofile['reputation']);

// If this user has permission to give reputations show the vote link

 
		$vote_link = '';

		if($mybb->usergroup['cangivereputations'] == 1 && $memprofile['uid'] != $mybb->user['uid'])
{
$vote_link = "[<a href=\"javascript:MyBB.reputation({$memprofile['uid']});\">{$lang->reputation_vote}</a>]";

		if($mybb->usergroup['cangivereputations'] == 1 && $memprofile['uid'] != $mybb->user['uid'])
{
$vote_link = "[<a href=\"javascript:MyBB.reputation({$memprofile['uid']});\">{$lang->reputation_vote}</a>]";

Zeile 1897Zeile 1916
		}
else
{

		}
else
{

			$warning_link = "usercp.php";


			$warn_user = '';
$warning_link = 'usercp.php';

		}
eval("\$warning_level = \"".$templates->get("member_profile_warninglevel")."\";");
}

		}
eval("\$warning_level = \"".$templates->get("member_profile_warninglevel")."\";");
}

Zeile 1922Zeile 1942
		$thing = explode("\n", $customfield['type'], "2");
$type = trim($thing[0]);


		$thing = explode("\n", $customfield['type'], "2");
$type = trim($thing[0]);


 
		$customfieldval = '';

		$field = "fid{$customfield['fid']}";

		$field = "fid{$customfield['fid']}";

		$useropts = explode("\n", $userfields[$field]);
$customfieldval = $comma = '';
if(is_array($useropts) && ($type == "multiselect" || $type == "checkbox"))
{
foreach($useropts as $val)
{
if($val != '')



if(isset($userfields[$field]))
{
$useropts = explode("\n", $userfields[$field]);
$customfieldval = $comma = '';
if(is_array($useropts) && ($type == "multiselect" || $type == "checkbox"))
{
foreach($useropts as $val)

				{

				{

					$customfieldval .= "<li style=\"margin-left: 0;\">{$val}</li>";








					if($val != '')
{
$customfieldval .= "<li style=\"margin-left: 0;\">{$val}</li>";
}
}
if($customfieldval != '')
{
$customfieldval = "<ul style=\"margin: 0; padding-left: 15px;\">{$customfieldval}</ul>";

				}

				}

			}
if($customfieldval != '')
{
$customfieldval = "<ul style=\"margin: 0; padding-left: 15px;\">{$customfieldval}</ul>";
}
}
else
{
$userfields[$field] = $parser->parse_badwords($userfields[$field]);

if($customfield['type'] == "textarea")
{
$customfieldval = nl2br(htmlspecialchars_uni($userfields[$field]));

 
			}
else

			}
else

			{
$customfieldval = htmlspecialchars_uni($userfields[$field]);










			{
$userfields[$field] = $parser->parse_badwords($userfields[$field]);

if($customfield['type'] == "textarea")
{
$customfieldval = nl2br(htmlspecialchars_uni($userfields[$field]));
}
else
{
$customfieldval = htmlspecialchars_uni($userfields[$field]);
}

			}
}


			}
}


Zeile 1972Zeile 1997
	{
$timeonline = $lang->none_registered;
}

	{
$timeonline = $lang->none_registered;
}

	



$adminoptions = '';

	if($mybb->usergroup['cancp'] == 1 && $mybb->config['hide_admin_links'] != 1)
{
eval("\$adminoptions = \"".$templates->get("member_profile_adminoptions")."\";");

	if($mybb->usergroup['cancp'] == 1 && $mybb->config['hide_admin_links'] != 1)
{
eval("\$adminoptions = \"".$templates->get("member_profile_adminoptions")."\";");

	}
else
{
$adminoptions = '';
}


	}

$modoptions = '';




	if($mybb->usergroup['canmodcp'] == 1)
{
$memprofile['usernotes'] = nl2br(htmlspecialchars_uni($memprofile['usernotes']));

	if($mybb->usergroup['canmodcp'] == 1)
{
$memprofile['usernotes'] = nl2br(htmlspecialchars_uni($memprofile['usernotes']));

Zeile 1992Zeile 2015
			{
$memprofile['usernotes'] = my_substr($memprofile['usernotes'], 0, 100).'...';
}

			{
$memprofile['usernotes'] = my_substr($memprofile['usernotes'], 0, 100).'...';
}

		}

		}

		else
{
$memprofile['usernotes'] = $lang->no_usernotes;

		else
{
$memprofile['usernotes'] = $lang->no_usernotes;

Zeile 2000Zeile 2023
		
eval("\$modoptions = \"".$templates->get("member_profile_modoptions")."\";");
}

		
eval("\$modoptions = \"".$templates->get("member_profile_modoptions")."\";");
}

	else
{
$modoptions = '';
}








	$buddy_options = '';

	$buddy_options = '';

	

 
	if($mybb->user['uid'] != $memprofile['uid'] && $mybb->user['uid'] != 0)
{
$buddy_list = explode(',', $mybb->user['buddylist']);

	if($mybb->user['uid'] != $memprofile['uid'] && $mybb->user['uid'] != 0)
{
$buddy_list = explode(',', $mybb->user['buddylist']);

Zeile 2031Zeile 2049
	}

$plugins->run_hooks("member_profile_end");

	}

$plugins->run_hooks("member_profile_end");

	



	eval("\$profile = \"".$templates->get("member_profile")."\";");
output_page($profile);
}

	eval("\$profile = \"".$templates->get("member_profile")."\";");
output_page($profile);
}