Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: member.php 4154 2008-08-30 06:06:59Z Tikitiki $
| * $Id: member.php 4274 2008-11-19 03:22:50Z Tikitiki $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 14 | Zeile 14 |
---|
$nosession['avatar'] = 1; $templatelist = "member_register,error_nousername,error_nopassword,error_passwordmismatch,error_invalidemail,error_usernametaken,error_emailmismatch,error_noemail,redirect_registered";
|
$nosession['avatar'] = 1; $templatelist = "member_register,error_nousername,error_nopassword,error_passwordmismatch,error_invalidemail,error_usernametaken,error_emailmismatch,error_noemail,redirect_registered";
|
$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";
| $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";
|
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 373 | Zeile 373 |
---|
if((!isset($mybb->input['agree']) && !isset($mybb->input['regsubmit'])) || $mybb->request_method != "post") { // Is this user a COPPA user? We need to show the COPPA agreement too
|
if((!isset($mybb->input['agree']) && !isset($mybb->input['regsubmit'])) || $mybb->request_method != "post") { // Is this user a COPPA user? We need to show the COPPA agreement too
|
if($mybb->setings['coppa'] != "disabled" && ($mybb->cookies['coppauser'] == 1 || $under_thirteen))
| if($mybb->settings['coppa'] != "disabled" && ($mybb->cookies['coppauser'] == 1 || $under_thirteen))
|
{ if($mybb->settings['coppa'] == "deny") {
| { if($mybb->settings['coppa'] == "deny") {
|
Zeile 946 | Zeile 946 |
---|
} }
|
} }
|
if($mybb->input['action'] == "login") { $plugins->run_hooks("member_login"); $member_loggedin_notice = ""; if($mybb->user['uid'] != 0) { $lang->already_logged_in = $lang->sprintf($lang->already_logged_in, build_profile_link($mybb->user['username'], $mybb->user['uid'])); eval("\$member_loggedin_notice = \"".$templates->get("member_loggedin_notice")."\";"); }
// 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 login_attempt_check();
// Redirect to the page where the user came from, but not if that was the login page. if($mybb->input['url'] && !preg_match("/action=login/i", $mybb->input['url'])) { $redirect_url = htmlentities($mybb->input['url']); } elseif($_SERVER['HTTP_REFERER']) { $redirect_url = htmlentities($_SERVER['HTTP_REFERER']); }
eval("\$login = \"".$templates->get("member_login")."\";"); output_page($login); }
| $do_captcha = $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();
| // 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();
|
Zeile 990 | Zeile 963 |
---|
$mybb->input['password'] = $mybb->input['quick_password']; $mybb->input['username'] = $mybb->input['quick_username']; }
|
$mybb->input['password'] = $mybb->input['quick_password']; $mybb->input['username'] = $mybb->input['quick_username']; }
|
if(!username_exists($mybb->input['username'])) { my_setcookie('loginattempts', $logins + 1); $db->write_query("UPDATE ".TABLE_PREFIX."sessions SET loginattempts=loginattempts+1 WHERE sid = '{$session->sid}'"); if($mybb->settings['failedlogintext'] == 1) { $login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins); } error($lang->error_invalidpworusername.$login_text); }
| if(!username_exists($mybb->input['username'])) { my_setcookie('loginattempts', $logins + 1); error($lang->error_invalidpworusername.$login_text); } $query = $db->simple_select("users", "loginattempts", "LOWER(username)='".$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'])
|
$user = validate_password_from_username($mybb->input['username'], $mybb->input['password']); if(!$user['uid'])
|
{
| {
|
my_setcookie('loginattempts', $logins + 1);
|
my_setcookie('loginattempts', $logins + 1);
|
$db->write_query("UPDATE ".TABLE_PREFIX."sessions SET loginattempts=loginattempts+1 WHERE sid = '{$session->sid}'");
| $db->write_query("UPDATE ".TABLE_PREFIX."users SET loginattempts=loginattempts+1 WHERE LOWER(username) = '".$db->escape_string(my_strtolower($mybb->input['username']))."'"); $mybb->input['action'] = "login"; $mybb->input['request_method'] = "get";
|
if($mybb->settings['failedlogintext'] == 1) { $login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);
|
if($mybb->settings['failedlogintext'] == 1) { $login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);
|
} error($lang->error_invalidpassword.$login_text);
| } $errors[] = $lang->error_invalidpworusername.$login_text; } else { $correct = true; } if($loginattempts > 3 || intval($mybb->cookies['loginattempts']) > 3) { // Show captcha image for guests if enabled if($mybb->settings['captchaimage'] == 1 && function_exists("imagepng") && !$mybb->user['uid']) { // If previewing a post - 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) { $correct = true; } 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']) { $errors[] = $lang->error_regimagerequired; } else { $errors[] = $lang->error_regimagerequired; } } $do_captcha = true; } if(!empty($errors)) { $mybb->input['action'] = "login"; $mybb->input['request_method'] = "get"; $inline_errors = inline_error($errors);
|
}
|
}
|
| else if($correct) { if($user['coppauser']) { 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."'"); $db->update_query("users", array("loginattempts" => 1), "uid='{$user['uid']}'"); // Temporarily set the cookie remember option for the login cookies $mybb->user['remember'] = $user['remember']; my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], null, true); my_setcookie("sid", $session->sid, -1, true); $plugins->run_hooks("member_do_login_end"); 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']); } $mybb->input['url'] = str_replace('&', '&', $mybb->input['url']); // Redirect to the URL if it is not member.php redirect(htmlentities($mybb->input['url']), $lang->redirect_loggedin); } else { redirect("index.php", $lang->redirect_loggedin); } } else { $mybb->input['action'] = "login"; $mybb->input['request_method'] = "get"; } $plugins->run_hooks("member_do_login_end"); }
|
|
|
if($user['coppauser'])
| if($mybb->input['action'] == "login") { $plugins->run_hooks("member_login"); $member_loggedin_notice = ""; if($mybb->user['uid'] != 0)
|
{
|
{
|
error($lang->error_awaitingcoppa);
| $lang->already_logged_in = $lang->sprintf($lang->already_logged_in, build_profile_link($mybb->user['username'], $mybb->user['uid'])); eval("\$member_loggedin_notice = \"".$templates->get("member_loggedin_notice")."\";");
|
}
|
}
|
my_setcookie('loginattempts', 1); $db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."' AND sid != '".$session->sid."'"); $newsession = array( "uid" => $user['uid'], "loginattempts" => 1, ); $db->update_query("sessions", $newsession, "sid='".$session->sid."'");
// Temporarily set the cookie remember option for the login cookies $mybb->user['remember'] = $user['remember'];
my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], null, true); my_setcookie("sid", $session->sid, -1, true);
$plugins->run_hooks("member_do_login_end");
| // 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 login_attempt_check();
|
|
|
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']);
| // Redirect to the page where the user came from, but not if that was the login page. if($mybb->input['url'] && !preg_match("/action=login/i", $mybb->input['url'])) { $redirect_url = htmlentities($mybb->input['url']); } elseif($_SERVER['HTTP_REFERER']) { $redirect_url = htmlentities($_SERVER['HTTP_REFERER']); } $captcha = ""; // Show captcha image for guests if enabled if($mybb->settings['captchaimage'] == 1 && function_exists("imagepng") && $do_captcha == true) { if(!$correct) { $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")."\";");
|
}
|
}
|
$mybb->input['url'] = str_replace('&', '&', $mybb->input['url']); // Redirect to the URL if it is not member.php redirect(htmlentities($mybb->input['url']), $lang->redirect_loggedin); } else
| } $username = ""; $password = ""; if($mybb->input['username'] && $mybb->request_method == "post") { $username = htmlspecialchars_uni($mybb->input['username']); } if($mybb->input['password'] && $mybb->request_method == "post")
|
{
|
{
|
redirect("index.php", $lang->redirect_loggedin);
| $password = htmlspecialchars_uni($mybb->input['password']);
|
}
|
}
|
}
| eval("\$login = \"".$templates->get("member_login")."\";"); output_page($login); }
|
if($mybb->input['action'] == "logout") {
| if($mybb->input['action'] == "logout") {
|
Zeile 1070 | Zeile 1165 |
---|
else if(!$mybb->input['sid'] && $mybb->input['logoutkey'] != $mybb->user['logoutkey']) { error($lang->error_notloggedout);
|
else if(!$mybb->input['sid'] && $mybb->input['logoutkey'] != $mybb->user['logoutkey']) { error($lang->error_notloggedout);
|
}
| }
|
my_unsetcookie("mybbuser"); my_unsetcookie("sid"); if($mybb->user['uid'])
| my_unsetcookie("mybbuser"); my_unsetcookie("sid"); if($mybb->user['uid'])
|
Zeile 1101 | Zeile 1196 |
---|
if($mybb->input['tid']) { $query = $db->simple_select("posts", "uid", "tid='".intval($mybb->input['tid'])."' AND visible = 1", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => '1'));
|
if($mybb->input['tid']) { $query = $db->simple_select("posts", "uid", "tid='".intval($mybb->input['tid'])."' AND visible = 1", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => '1'));
|
$post = $db->fetch_array($query); $uid = $post['uid'];
| $post = $db->fetch_array($query); $uid = $post['uid'];
|
} elseif($mybb->input['fid']) {
| } elseif($mybb->input['fid']) {
|
Zeile 1132 | Zeile 1227 |
---|
$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 {
|
Zeile 1150 | Zeile 1245 |
---|
{ $query = $db->simple_select("users", "*", "uid='$uid'"); $memprofile = $db->fetch_array($query);
|
{ $query = $db->simple_select("users", "*", "uid='$uid'"); $memprofile = $db->fetch_array($query);
|
} else {
| } else {
|
$memprofile = $mybb->user; }
| $memprofile = $mybb->user; }
|
Zeile 1161 | Zeile 1256 |
---|
if(!$memprofile['uid']) { error($lang->error_nomember);
|
if(!$memprofile['uid']) { error($lang->error_nomember);
|
}
| }
|
// Get member's permissions $memperms = user_permissions($memprofile['uid']);
| // Get member's permissions $memperms = user_permissions($memprofile['uid']);
|
Zeile 1213 | Zeile 1308 |
---|
{ $memprofile['website'] = htmlspecialchars_uni($memprofile['website']); $website = "<a href=\"{$memprofile['website']}\" target=\"_blank\">{$memprofile['website']}</a>";
|
{ $memprofile['website'] = htmlspecialchars_uni($memprofile['website']); $website = "<a href=\"{$memprofile['website']}\" target=\"_blank\">{$memprofile['website']}</a>";
|
} else {
| } else {
|
$website = ''; }
| $website = ''; }
|
Zeile 1379 | Zeile 1474 |
---|
if(!$memprofile['displaygroup']) { $memprofile['displaygroup'] = $memprofile['usergroup'];
|
if(!$memprofile['displaygroup']) { $memprofile['displaygroup'] = $memprofile['usergroup'];
|
}
| }
|
$displaygroup = usergroup_displaygroup($memprofile['displaygroup']);
// Get the user title for this user
|
$displaygroup = usergroup_displaygroup($memprofile['displaygroup']);
// Get the user title for this user
|
| unset($usertitle); unset($stars);
|
if(trim($memprofile['usertitle']) != '') { // User has custom user title $usertitle = $memprofile['usertitle'];
|
if(trim($memprofile['usertitle']) != '') { // User has custom user title $usertitle = $memprofile['usertitle'];
|
}
| }
|
elseif(trim($displaygroup['usertitle']) != '') { // User has group title
| elseif(trim($displaygroup['usertitle']) != '') { // User has group title
|
Zeile 1401 | Zeile 1498 |
---|
{ if($memprofile['postnum'] >= $title['posts']) {
|
{ if($memprofile['postnum'] >= $title['posts']) {
|
$usertitle = $title['title'];
| $usertitle = $title['title']; $stars = $title['stars']; $starimage = $title['starimage']; break; } } } if($displaygroup['stars']) { // Set the number of stars if display group has constant number of stars $stars = $displaygroup['stars']; } elseif(!$stars) { // This is for cases where the user has a title, but the group has no defined number of stars (use number of stars as per default usergroups) $query = $db->simple_select("usertitles", "*", "", array('order_by' => 'posts', 'order_dir' => 'DESC')); while($title = $db->fetch_array($query)) { if($memprofile['postnum'] >= $title['posts']) {
|
$stars = $title['stars']; $starimage = $title['starimage']; break; } }
|
$stars = $title['stars']; $starimage = $title['starimage']; break; } }
|
} if($displaygroup['stars']) { $stars = $displaygroup['stars'];
| |
}
if(!empty($displaygroup['image']))
| }
if(!empty($displaygroup['image']))
|
Zeile 1627 | Zeile 1739 |
---|
if(count($errors) == 0) {
|
if(count($errors) == 0) {
|
$from = "{$mybb->user['username']} <{$mybb->user['email']}>";
| if($mybb->settings['mail_handler'] == 'smtp') { $from = $mybb->user['email']; } else { $from = "{$mybb->user['username']} <{$mybb->user['email']}>"; }
|
$message = $lang->sprintf($lang->email_emailuser, $to_user['username'], $mybb->user['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $mybb->input['message']);
|
$message = $lang->sprintf($lang->email_emailuser, $to_user['username'], $mybb->user['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $mybb->input['message']);
|
my_mail($to_user['email'], $mybb->input['subject'], $message, $from);
| my_mail($to_user['email'], $mybb->input['subject'], $message, $from, "", "", false, "text", "", $mybb->user['email']);
|
if($mybb->settings['mail_logging'] > 0) {
| if($mybb->settings['mail_logging'] > 0) {
|