diff options
| author | uid42062 <uid42062@users.sourceforge.net> | 2001-07-04 19:36:32 +0000 |
|---|---|---|
| committer | uid42062 <uid42062@users.sourceforge.net> | 2001-07-04 19:36:32 +0000 |
| commit | a6723b8a1ba6ebf4a455a7a56b804d4973463402 (patch) | |
| tree | bb12bdafdeceec35aa0b9cd3680654de904f6a6e /phpBB/profile.php | |
| parent | b2c10ae40b1815cdd72eea15b6d7d646e937a26d (diff) | |
| download | forums-a6723b8a1ba6ebf4a455a7a56b804d4973463402.tar forums-a6723b8a1ba6ebf4a455a7a56b804d4973463402.tar.gz forums-a6723b8a1ba6ebf4a455a7a56b804d4973463402.tar.bz2 forums-a6723b8a1ba6ebf4a455a7a56b804d4973463402.tar.xz forums-a6723b8a1ba6ebf4a455a7a56b804d4973463402.zip | |
Lots of updates
git-svn-id: file:///svn/phpbb/trunk@553 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/profile.php')
| -rw-r--r-- | phpBB/profile.php | 1358 |
1 files changed, 552 insertions, 806 deletions
diff --git a/phpBB/profile.php b/phpBB/profile.php index 7cfeb787b5..d11f447838 100644 --- a/phpBB/profile.php +++ b/phpBB/profile.php @@ -64,6 +64,7 @@ function language_select($default, $dirname="language/") function template_select($default) { $dir = opendir("templates"); + $template_select = "<select name=\"template\">\n"; while($file = readdir($dir)) { @@ -93,6 +94,7 @@ function theme_select($default) { $num = $db->sql_numrows($result); $rowset = $db->sql_fetchrowset($result); + $theme_select = "<select name=\"theme\">\n"; for($i = 0; $i < $num; $i++) { @@ -104,7 +106,7 @@ function theme_select($default) { $selected = ""; } - $theme_select .= "\t<option value=\"".$rowset[$i]['themes_id']."\"$selected>".stripslashes($rowset[$i]['themes_name'])."</option>\n"; + $theme_select .= "\t<option value=\"" . $rowset[$i]['themes_id'] ."\"$selected>" . stripslashes($rowset[$i]['themes_name']) . "</option>\n"; } $theme_select .= "</select>\n"; } @@ -149,22 +151,15 @@ function tz_select($default) "+6" => "(GMT +6:00 hours) Almaty, Colombo, Dhaka", "+7" => "(GMT +7:00 hours) Bangkok, Hanoi, Jakarta", "+8" => "(GMT +8:00 hours) Beijing, Chongqing, Hong Kong, Perth, Singapore, Taipei", - "+9" => "(GMT +9:00 hours) Tokyo, Seoul, Osaka, Sapporo, Yakutsk", + "+9" => "(GMT +9:00 hours) Osaka, Sapporo, Seoul, Tokyo, Yakutsk", "+9.5" => "(GMT +9:30 hours) Adelaide, Darwin", "+10" => "(GMT +10:00 hours) Guam, Melbourne, Papua New Guinea, Sydney, Vladivostok", - "+11" => "(GMT +11:00 hours) Magadan, Solomon Islands, New Caledonia", + "+11" => "(GMT +11:00 hours) Magadan, New Caledonia, Solomon Islands", "+12" => "(GMT +12:00 hours) Auckland, Wellington, Fiji, Kamchatka, Marshall Island"); while(list($offset, $zone) = each($tz_array)) { - if($offset == $default) - { - $selected = " selected"; - } - else - { - $selected = ""; - } + $selected = ($offset == $default) ? " selected" : ""; $tz_select .= "\t<option value=\"$offset\"$selected>$zone</option>\n"; } $tz_select .= "</select>\n"; @@ -185,251 +180,343 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) // // Begin page proper // - switch($mode) + if($mode == "viewprofile") { - case 'viewprofile': - $pagetype = "profile"; - $page_title = "$l_profile"; + $pagetype = "profile"; + $page_title = "$l_profile"; + + // + // Output page header and + // profile_view template + // + include('includes/page_header.'.$phpEx); + + $template->set_filenames(array( + "body" => "profile_view_body.tpl", + "jumpbox" => "jumpbox.tpl") + ); + $jumpbox = make_jumpbox(); + $template->assign_vars(array( + "JUMPBOX_LIST" => $jumpbox, + "SELECT_NAME" => POST_FORUM_URL) + ); + $template->assign_var_from_handle("JUMPBOX", "jumpbox"); + // + // End header + // + + if(!$HTTP_GET_VARS[POST_USERS_URL]) + { + message_die(GENERAL_ERROR, "You must supply the user ID number of the user you want to view", "", __LINE__, __FILE__); + } + $profiledata = get_userdata_from_id($HTTP_GET_VARS[POST_USERS_URL]); - // - // Output page header and - // profile_view template - // - include('includes/page_header.'.$phpEx); - - $template->set_filenames(array( - "body" => "profile_view_body.tpl", - "jumpbox" => "jumpbox.tpl") - ); - $jumpbox = make_jumpbox(); - $template->assign_vars(array( - "JUMPBOX_LIST" => $jumpbox, - "SELECT_NAME" => POST_FORUM_URL) - ); - $template->assign_var_from_handle("JUMPBOX", "jumpbox"); - // - // End header - // + // + // Calculate the number of days this user has been a member ($memberdays) + // Then calculate their posts per day + // + $regdate = $profiledata['user_regdate']; - if(!$HTTP_GET_VARS[POST_USERS_URL]) - { - if(DEBUG) - { - error_die(GENERAL_ERROR, "You must supply the user ID number of the user you want to view", __LINE__, __FILE__); - } - else - { - error_die(GENERAL_ERROR, $l_nouserid); - } - } - $profiledata = get_userdata_from_id($HTTP_GET_VARS[POST_USERS_URL]); + $memberdays = (time() - $regdate) / (24*60*60); + $posts_per_day = sprintf("%.2f", $profiledata['user_posts'] / $memberdays); - // - // Calculate the number of days this user has been a member ($memberdays) - // Then calculate their posts per day - // - $regdate = $profiledata['user_regdate']; + // Get the users percentage of total posts + if($profiledata['user_posts'] != 0) + { + $total_posts = get_db_stat("postcount"); + $percentage = sprintf("%.2f", ($profiledata['user_posts'] / $total_posts) * 100); + } + else + { + $percentage = 0; + } + + if($profiledata['user_viewemail']) + { + // Replace the @ with 'at'. Some anti-spam mesures. + $email_addr = str_replace("@", " at ", $profiledata['user_email']); + $email = "<a href=\"mailto:$email_addr\">$email_addr</a>"; + } + else + { + $email = $l_hidden; + } + $template->assign_vars(array( + "USERNAME" => stripslashes($profiledata['username']), + "JOINED" => create_date($board_config['default_dateformat'], $profiledata['user_regdate'], $board_config['default_timezone']), + "POSTS_PER_DAY" => $posts_per_day, + "POSTS" => $profiledata['user_posts'], + "PERCENTAGE" => $percentage . "%", + "EMAIL" => $email, + "ICQ" => stripslashes($profiledata['user_icq']), + "AIM" => stripslashes($profiledata['user_aim']), + "MSN" => stripslashes($profiledata['user_msnm']), + "YIM" => stripslashes($profiledata['user_yim']), + "WEBSITE" => stripslashes($profiledata['user_website']), + "LOCATION" => stripslashes($profiledata['user_from']), + "OCCUPATION" => stripslashes($profiledata['user_occ']), + "INTERESTS" => stripslashes($profiledata['user_interests']), + "AVATAR_IMG" => $board_config['avatar_path'] . "/" . stripslashes($profiledata['user_avatar']), + + "L_VIEWING_PROFILE" => $l_viewing_profile, + "L_USERNAME" => $lang['Username'], + "L_VIEW_USERS_POSTS" => $l_view_users_posts, + "L_JOINED" => $l_joined, + "L_PER_DAY" => $l_per_day, + "L_OF_TOTAL" => $l_of_total, + "L_EMAIL_ADDRESS" => $l_emailaddress, + "L_ICQ_NUMBER" => $l_icq_number, + "L_YAHOO" => $l_yahoo, + "L_AIM" => $l_aim, + "L_WEBSITE" => $l_website, + "L_MESSENGER" => $l_messenger, + "L_LOCATION" => $l_from, + "L_OCCUPATION" => $l_occupation, + "L_INTERESTS" => $l_interests, + "L_AVATAR" => $lang['Avatar'], + + "U_SEARCH_USER" => append_sid("search.$phpEx?a=" . urlencode($profiledata['username']) . "&f=all&b=0&d=DESC&c=100&dosearch=1"), + "U_USER_WEBSITE" => stripslashes($profiledata['user_website']), + + "S_PROFILE_ACTION" => append_sid("profile.$phpEx")) + ); + + $template->pparse("body"); + + include('includes/page_tail.'.$phpEx); + + } + else if($mode == "editprofile" || $mode == "register") + { + + if(!$userdata['session_logged_in'] && $mode == "editprofile") + { + header(append_sid("Location: login.$phpEx?forward_page=$PHP_SELF&mode=editprofile")); + } - $memberdays = (time() - $regdate) / (24*60*60); - $posts_per_day = sprintf("%.2f", $profiledata['user_posts'] / $memberdays); + $pagetype = ($mode == "edit") ? "editprofile" : "register"; + $page_title = ($mode == "edit") ? $lang['Edit_profile'] : $lang['Register']; - // Get the users percentage of total posts - if($profiledata['user_posts'] != 0) + include('includes/page_header.'.$phpEx); + + // + // Start processing for output + // + if($mode == "register" && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed'])) + { + if(!isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed'])) { - $total_posts = get_db_stat("postcount"); - $percentage = sprintf("%.2f", ($profiledata['user_posts'] / $total_posts) * 100); + // + // Load agreement template since user has not yet + // agreed to registration conditions/coppa + // + $template->set_filenames(array( + "body" => "agreement.tpl", + "jumpbox" => "jumpbox.tpl") + ); + $jumpbox = make_jumpbox(); + $template->assign_vars(array( + "JUMPBOX_LIST" => $jumpbox, + "SELECT_NAME" => POST_FORUM_URL) + ); + $template->assign_var_from_handle("JUMPBOX", "jumpbox"); + $template->assign_vars(array( + "COPPA" => $coppa, + + "U_AGREE_OVER13" => append_sid("profile.$phpEx?mode=register&agreed=true"), + "U_AGREE_UNDER13" => append_sid("profile.$phpEx?mode=register&agreed=true&coppa=true")) + ); + $template->pparse("body"); + + include('includes/page_tail.'.$phpEx); } - else + } + else if(isset($HTTP_POST_VARS['submit']) || $mode == "register") + { + if($mode == "editprofile") { - $percentage = 0; + $user_id = $HTTP_POST_VARS['user_id']; } + $username = (!empty($HTTP_POST_VARS['username'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['username']))) : ""; + $email = (!empty($HTTP_POST_VARS['email'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['email']))) : ""; + + $password = (!empty($HTTP_POST_VARS['password'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['password']))) : ""; + $password_confirm = (!empty($HTTP_POST_VARS['password_confirm'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['password_confirm']))) : ""; + + $icq = (!empty($HTTP_POST_VARS['icq'])) ? trim(strip_tags($HTTP_POST_VARS['icq'])) : ""; + $aim = (!empty($HTTP_POST_VARS['aim'])) ? trim(strip_tags($HTTP_POST_VARS['aim'])) : ""; + $msn = (!empty($HTTP_POST_VARS['msn'])) ? trim(strip_tags($HTTP_POST_VARS['msn'])) : ""; + $yim = (!empty($HTTP_POST_VARS['yim'])) ? trim(strip_tags($HTTP_POST_VARS['yim'])) : ""; - if($profiledata['user_viewemail']) + $website = (!empty($HTTP_POST_VARS['website'])) ? trim(strip_tags($HTTP_POST_VARS['website'])) : ""; + $location = (!empty($HTTP_POST_VARS['location'])) ? trim(strip_tags($HTTP_POST_VARS['location'])) : ""; + $occupation = (!empty($HTTP_POST_VARS['occupation'])) ? trim(strip_tags($HTTP_POST_VARS['occupation'])) : ""; + $interests = (!empty($HTTP_POST_VARS['interests'])) ? trim($HTTP_POST_VARS['interests']) : ""; + $signature = (!empty($HTTP_POST_VARS['signature'])) ? trim(str_replace("<br />", "\n", $HTTP_POST_VARS['signature'])) : ""; + + $viewemail = (!empty($HTTP_POST_VARS['viewemail'])) ? $HTTP_POST_VARS['viewemail'] : 0; + $notifypm = (!empty($HTTP_POST_VARS['notifypm'])) ? $HTTP_POST_VARS['notifypm'] : 1; + $attachsig = (!empty($HTTP_POST_VARS['attachsig'])) ? $HTTP_POST_VARS['attachsig'] : 0; + + $allowhtml = (!empty($HTTP_POST_VARS['allowhtml'])) ? $HTTP_POST_VARS['allowhtml'] : $board_config['allow_html']; + $allowbbcode = (!empty($HTTP_POST_VARS['allowbbcode'])) ? $HTTP_POST_VARS['allowbbcode'] : $board_config['allow_bbcode']; + $allowsmilies = (!empty($HTTP_POST_VARS['allowsmilies'])) ? $HTTP_POST_VARS['allowsmilies'] : $board_config['allow_smilies']; + + $allowviewonline = (!empty($HTTP_POST_VARS['allowviewonline'])) ? ( ($HTTP_POST_VARS['allowviewonline']) ? 0 : 1 ) : 1; + + $user_theme = ($HTTP_POST_VARS['theme']) ? $HTTP_POST_VARS['theme'] : $board_config['default_theme']; + $user_lang = ($HTTP_POST_VARS['language']) ? $HTTP_POST_VARS['language'] : $board_config['default_lang']; + $user_timezone = (isset($HTTP_POST_VARS['timezone'])) ? $HTTP_POST_VARS['timezone'] : $board_config['default_timezone']; + $user_template = ($HTTP_POST_VARS['template']) ? $HTTP_POST_VARS['template'] : $board_config['default_template']; + $user_dateformat = ($HTTP_POST_VARS['dateformat']) ? trim($HTTP_POST_VARS['dateformat']) : $board_config['default_dateformat']; + + $user_avatar_url = (!empty($HTTP_POST_VARS['avatarurl'])) ? $HTTP_POST_VARS['avatarurl'] : ""; + $user_avatar_loc = ($HTTP_POST_FILES['avatar']['tmp_name'] != "none") ? $HTTP_POST_FILES['avatar']['tmp_name'] : ""; + $user_avatar_name = (!empty($HTTP_POST_FILES['avatar']['name'])) ? $HTTP_POST_FILES['avatar']['name'] : ""; + $user_avatar_size = (!empty($HTTP_POST_FILES['avatar']['size'])) ? $HTTP_POST_FILES['avatar']['size'] : 0; + $user_avatar_type = (!empty($HTTP_POST_FILES['avatar']['type'])) ? $HTTP_POST_FILES['avatar']['type'] : ""; + $user_avatar = (empty($user_avatar_loc) && $mode == "editprofile") ? $userdata['user_avatar'] : ""; + + } + if(isset($HTTP_POST_VARS['submit'])) + { + $error = FALSE; + + $passwd_sql = ""; + if($mode == "editprofile") { - // Replace the @ with 'at'. Some anti-spam mesures. - $email_addy = str_replace("@", " at ", $profiledata['user_email']); - $email = "<a href=\"mailto:$email_addy\">$email_addy</a>"; + if($user_id != $userdata['user_id']) + { + $error = TRUE; + $error_msg = $lang['Wrong_Profile']; + } } - else + else if($mode == "register") { - $email = $l_hidden; - } - $template->assign_vars(array( - "USERNAME" => stripslashes($profiledata['username']), - "JOINED" => create_date($board_config['default_dateformat'], $profiledata['user_regdate'], $board_config['default_timezone']), - "POSTS_PER_DAY" => $posts_per_day, - "POSTS" => $profiledata['user_posts'], - "PERCENTAGE" => $percentage . "%", - "EMAIL" => $email, - "ICQ" => stripslashes($profiledata['user_icq']), - "AIM" => stripslashes($profiledata['user_aim']), - "MSN" => stripslashes($profiledata['user_msnm']), - "L_YAHOO" => stripslashes($l_yahoo), - "YIM" => stripslashes($profiledata['user_yim']), - "WEBSITE" => stripslashes($profiledata['user_website']), - "LOCATION" => stripslashes($profiledata['user_from']), - "OCCUPATION" => stripslashes($profiledata['user_occ']), - "INTERESTS" => stripslashes($profiledata['user_interests']), - "AVATAR_IMG" => $board_config['avatar_path'] . "/" . stripslashes($profiledata['user_avatar']), - - "L_VIEWING_PROFILE" => $l_viewing_profile, - "L_USERNAME" => $lang['Username'], - "L_VIEW_USERS_POSTS" => $l_view_users_posts, - "L_JOINED" => $l_joined, - "L_PER_DAY" => $l_per_day, - "L_OF_TOTAL" => $l_of_total, - "L_EMAIL_ADDRESS" => $l_emailaddress, - "L_ICQ_NUMBER" => $l_icq_number, - "L_AIM" => $l_aim, - "L_WEBSITE" => $l_website, - "L_MESSENGER" => $l_messenger, - "L_LOCATION" => $l_from, - "L_OCCUPATION" => $l_occupation, - "L_INTERESTS" => $l_interests, - "L_AVATAR" => $lang['Avatar'], - - "U_SEARCH_USER" => append_sid("search.$phpEx?a=".urlencode($profiledata['username'])."&f=all&b=0&d=DESC&c=100&dosearch=1"), - "U_USER_WEBSITE" => stripslashes($profiledata['user_website']), - - "S_PROFILE_ACTION" => append_sid("profile.$phpEx")) - ); - - $template->pparse("body"); - include('includes/page_tail.'.$phpEx); - break; + $regdate = get_gmt_ts(); - case 'editprofile': + $coppa = (!$HTTP_POST_VARS['coppa'] && !$HTTP_GET_VARS['coppa']) ? 0 : 1; - if(!$userdata['session_logged_in']) - { - header(append_sid("Location: login.$phpEx?forward_page=$PHP_SELF&mode=editprofile")); + if(empty($username) || empty($password) || empty($password_confirm) || empty($email)) + { + $error = TRUE; + $error_msg = $lang['Fields_empty']; + } } - $pagetype = "register"; - $page_title = "$l_register"; // - // Output page header and - // profile_add template - // - include('includes/page_header.'.$phpEx); - // - // End header + // Do a ban check on this email address // + $sql = "SELECT ban_email + FROM " . BANLIST_TABLE; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't obtain email ban information.", "", __LINE__, __FILE__, $sql); + } + $ban_email_list = $db->sql_fetchrowset($result); + for($i = 0; $i < count($ban_email_list); $i++) + { + if( eregi("^" . $ban_email_list[$i]['ban_email'] . "$", $email) ) + { + $error = TRUE; + if(isset($error_msg)) + { + $error_msg .= "<br />"; + } + $error_msg .= $lang['Sorry_banned_email']; + } + } - if(isset($HTTP_POST_VARS['submit'])) + if(!empty($password) && !empty($password_confirm)) { - $user_id = $HTTP_POST_VARS['user_id']; - $username = (!empty($HTTP_POST_VARS['username'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['username']))) : ""; - $email = (!empty($HTTP_POST_VARS['email'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['email']))) : ""; - $password = (!empty($HTTP_POST_VARS['password'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['password']))) : ""; - $password_confirm = (!empty($HTTP_POST_VARS['password_confirm'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['password_confirm']))) : ""; - - $icq = (!empty($HTTP_POST_VARS['icq'])) ? trim(strip_tags($HTTP_POST_VARS['icq'])) : ""; - $aim = (!empty($HTTP_POST_VARS['aim'])) ? trim(strip_tags($HTTP_POST_VARS['aim'])) : ""; - $msn = (!empty($HTTP_POST_VARS['msn'])) ? trim(strip_tags($HTTP_POST_VARS['msn'])) : ""; - $yim = (!empty($HTTP_POST_VARS['yim'])) ? trim(strip_tags($HTTP_POST_VARS['yim'])) : ""; - - $website = (!empty($HTTP_POST_VARS['website'])) ? trim(strip_tags($HTTP_POST_VARS['website'])) : ""; - $location = (!empty($HTTP_POST_VARS['location'])) ? trim(strip_tags($HTTP_POST_VARS['location'])) : ""; - $occupation = (!empty($HTTP_POST_VARS['occupation'])) ? trim(strip_tags($HTTP_POST_VARS['occupation'])) : ""; - $interests = (!empty($HTTP_POST_VARS['interests'])) ? trim($HTTP_POST_VARS['interests']) : ""; - $signature = (!empty($HTTP_POST_VARS['signature'])) ? trim(str_replace("<br />", "\n", $HTTP_POST_VARS['signature'])) : ""; - - $viewemail = $HTTP_POST_VARS['viewemail']; - $notifypm = $HTTP_POST_VARS['notifypm']; - $attachsig = $HTTP_POST_VARS['attachsig']; - $allowhtml = $HTTP_POST_VARS['allowhtml']; - $allowbbcode = $HTTP_POST_VARS['allowbbcode']; - $allowsmilies = $HTTP_POST_VARS['allowsmilies']; - $allowviewonline = ($HTTP_POST_VARS['allowviewonline']) ? 0 : 1; - - $user_theme = ($HTTP_POST_VARS['theme']) ? $HTTP_POST_VARS['theme'] : $board_config['default_theme']; - $user_lang = ($HTTP_POST_VARS['language']) ? $HTTP_POST_VARS['language'] : $board_config['default_lang']; - $user_timezone = (isset($HTTP_POST_VARS['timezone'])) ? $HTTP_POST_VARS['timezone'] : $board_config['default_timezone']; - $user_template = ($HTTP_POST_VARS['template']) ? $HTTP_POST_VARS['template'] : $board_config['default_template']; - $user_dateformat = ($HTTP_POST_VARS['dateformat']) ? trim($HTTP_POST_VARS['dateformat']) : $board_config['default_dateformat']; - - $user_avatar_url = (!empty($HTTP_POST_VARS['avatarurl'])) ? $HTTP_POST_VARS['avatarurl'] : ""; - $user_avatar_loc = ($HTTP_POST_FILES['avatar']['tmp_name'] != "none") ? $HTTP_POST_FILES['avatar']['tmp_name'] : ""; - $user_avatar_name = (!empty($HTTP_POST_FILES['avatar']['name'])) ? $HTTP_POST_FILES['avatar']['name'] : ""; - $user_avatar_size = (!empty($HTTP_POST_FILES['avatar']['size'])) ? $HTTP_POST_FILES['avatar']['size'] : 0; - $user_avatar_type = (!empty($HTTP_POST_FILES['avatar']['type'])) ? $HTTP_POST_FILES['avatar']['type'] : ""; - $user_avatar = (empty($user_avatar_loc)) ? $userdata['user_avatar'] : ""; - - $error = FALSE; - - $passwd_sql = ""; - if($user_id != $userdata['user_id']) + // The user wants to change their password, isn't that cute.. + if($password != $password_confirm) { $error = TRUE; - $error_msg = $lang['Wrong_Profile']; + $error_msg = $lang['Password_mismatch']; + } + else + { + $password = md5($password); + $passwd_sql = "user_password = '$password', "; } + } + else if($password && !$password_confirm) + { + $error = TRUE; + $error_msg = $lang['Password_mismatch']; + } - if(!empty($password) && !empty($password_confirm)) + if($board_config['allow_namechange'] || $mode == "register") + { + if($username != $userdata['username'] || $mode == "register") { - // The user wants to change their password, isn't that cute.. - if($password != $password_confirm) + if(!validate_username($username)) { $error = TRUE; - $error_msg = $l_mismatch . "<br />" . $l_tryagain; + if(isset($error_msg)) + { + $error_msg .= "<br />"; + } + $error_msg .= $lang['Invalid_username']; } else { - $password = md5($password); - $passwd_sql = "user_password = '$password', "; + $username_sql = "username = '$username', "; } } - else if($password && !$password_confirm) + } + + if($mode == "register") + { + // + // The AUTO_INCREMENT field in MySQL v3.23 doesn't work + // correctly when there is a row with -1 in that field + // so we have to explicitly get the next user ID + // + $sql = "SELECT MAX(user_id) AS total + FROM ".USERS_TABLE; + if($result = $db->sql_query($sql)) { - $error = TRUE; - $error_msg = $l_mismatch . "<br />" . $l_tryagain; - } + $user_id_row = $db->sql_fetchrow($result); + $new_user_id = $user_id_row['total'] + 1; - if($board_config['allow_namechange']) + unset($result); + unset($user_id_row); + } + else { - if($username != $userdata['username']) - { - if(!validate_username($username)) - { - $error = TRUE; - if(isset($error_msg)) - { - $error_msg .= "<br />"; - } - $error_msg .= $l_invalidname; - } - else - { - $username_sql = "username = '$username', "; - } - } + message_die(GENERAL_ERROR, "Couldn't obtained next user_id information.", "", __LINE__, __FILE__, $sql); } + } - if($board_config['allow_avatar_upload'] && !$error) + if($board_config['allow_avatar_upload'] && !$error) + { + // + // Only allow one type of upload, either a + // filename or a URL + // + if(!empty($user_avatar_loc) && !empty($user_avatar_url)) { - // - // Only allow one type of upload, either a - // filename or a URL - // - if(!empty($user_avatar_loc) && !empty($user_avatar_url)) + $error = TRUE; + if(isset($error_msg)) { - $error = TRUE; - if(isset($error_msg)) - { - $error_msg .= "<br />"; - } - $error_msg .= $lang['Only_one_avatar']; + $error_msg .= "<br />"; } + $error_msg .= $lang['Only_one_avatar']; + } - if(isset($HTTP_POST_VARS['avatardel'])) + if(isset($HTTP_POST_VARS['avatardel']) && $mode == "editprofile") + { + if(file_exists("./".$board_config['avatar_path']."/".$userdata['user_avatar'])) { - if(file_exists("./".$board_config['avatar_path']."/".$userdata['user_avatar'])) - { - @unlink("./".$board_config['avatar_path']."/".$userdata['user_avatar']); - $avatar_sql = ", user_avatar = ''"; - } + @unlink("./".$board_config['avatar_path']."/".$userdata['user_avatar']); + $avatar_sql = ", user_avatar = ''"; } - else if(!empty($user_avatar_loc)) + } + else if(!empty($user_avatar_loc)) + { + if($board_config['allow_avatar_upload']) { if(file_exists($user_avatar_loc) && ereg(".jpg$|.gif$|.png$", $user_avatar_name)) { @@ -449,7 +536,7 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) break; default: $error = true; - $error_msg = (!empty($error_msg)) ? $error_msg."<br>The avatar filetype must be .jpg, .gif or .png" : "The avatar filetype must be .jpg, .gif or .png"; + $error_msg = (!empty($error_msg)) ? $error_msg . "<br>" . $lang['Avatar_filetype'] : $lang['Avatar_filetype']; break; } @@ -460,11 +547,16 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) if( $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] ) { - $avatar_filename = $userdata['user_id'] . $imgtype; + $user_id = ($mode == "register") ? $new_user_id : $userdata['user_id']; - if(file_exists("./" . $board_config['avatar_path'] . "/" . $userdata['user_id'])) + $avatar_filename = $user_id . $imgtype; + + if($mode == "editprofile") { - @unlink("./" . $board_config['avatar_path'] . "/" . $userdata['user_id']); + if(file_exists("./" . $board_config['avatar_path'] . "/" . $user_id)) + { + @unlink("./" . $board_config['avatar_path'] . "/" . $user_id); + } } @copy($user_avatar_loc, "./" . $board_config['avatar_path'] . "/$avatar_filename"); $avatar_sql = ", user_avatar = '$avatar_filename'"; @@ -472,46 +564,43 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) else { $error = true; - $error_msg = (!empty($error_msg)) ? $error_msg . "<br>The avatar must be less than " . $board_config['avatar_max_width'] . " pixels wide and " . $board_config['avatar_max_height'] . " pixels high" : "The avatar must be less than " . $board_config['avatar_max_width'] . " pixels wide and " . $board_config['avatar_max_height'] . " pixels high"; + $error_msg = (!empty($error_msg)) ? $error_msg . "<br>" . $lang['Avatar_imagesize'] : $lang['Avatar_imagesize']; } } } else { $error = true; - $error_msg = (!empty($error_msg)) ? $error_msg."<br>The avatar image file size must more than 0 kB and less than ".round($board_config['avatar_filesize']/1024)." kB" : "The avatar image file size must more than 0 kB and less than ".round($board_config['avatar_filesize']/1024)." kB"; + $error_msg = (!empty($error_msg)) ? $error_msg . "<br>" . $lang['Avatar_filesize'] : $lang['Avatar_filesize']; } } else { $error = true; - $error_msg = (!empty($error_msg)) ? $error_msg."<br>The avatar filetype must be .jpg, .gif or .png" : "The avatar filetype must be .jpg, .gif or .png"; + $error_msg = (!empty($error_msg)) ? $error_msg . "<br>" . $lang['Avatar_filetype'] : $lang['Avatar_filetype']; } - } - else if(!empty($user_avatar_url)) + } // if ... allow_avatar_upload + } + else if(!empty($user_avatar_url)) + { + if($board_config['allow_avatar_upload']) { // // First check what port we should connect // to, look for a :[xxxx]/ or, if that doesn't - // exist see whether we're http:// or ftp:// - // if neither of these then assume its http:// + // exist assume port 80 (http) // preg_match("/^(http:\/\/)?([^\/]+?)\:?([0-9]*)\/(.*)$/", $user_avatar_url, $url_ary); - if(!empty($url_ary[3])) - { - $port = $url_ary[3]; - } - else - { - $port = 80; - } if(!empty($url_ary[4])) { + $port = (!empty($url_ary[3])) ? $url_ary[3] : 80; + $fsock = fsockopen($url_ary[2], $port, $errno, $errstr); if($fsock) { $base_get = "http://" . $url_ary[2] . "/" . $url_ary[4]; + // // Uses HTTP 1.1, could use HTTP 1.0 ... // @@ -544,10 +633,10 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) break; default: $error = true; - $error_msg = (!empty($error_msg)) ? $error_msg . "<br>The avatar filetype must be .jpg, .gif or .png" : "The avatar filetype must be .jpg, .gif or .png"; + $error_msg = (!empty($error_msg)) ? $error_msg . "<br>" . $lang['Avatar_filetype'] : $lang['Avatar_filetype']; break; } - + if(!$error && $file_size > 0 && $file_size < $board_config['avatar_filesize']) { $avatar_data = substr($avatar_data, strlen($avatar_data) - $file_size, $file_size); @@ -563,14 +652,19 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) if( $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] ) { - $avatar_filename = $userdata['user_id'] . $imgtype; + $user_id = ($mode == "register") ? $new_user_id : $userdata['user_id']; - if(file_exists("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar'])) + $avatar_filename = $user_id . $imgtype; + + if($mode == "editprofile") { - @unlink("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar']); + if(file_exists("./" . $board_config['avatar_path'] . "/" . $user_id)) + { + @unlink("./" . $board_config['avatar_path'] . "/" . $user_id); + } } copy($tmp_filename, "./" . $board_config['avatar_path'] . "/$avatar_filename"); - $avatar_sql = ", user_avatar = '$avatar_filename'"; + $avatar_sql = ", user_avatar = '$avatar_filename'"; @unlink($tmp_filename); } else @@ -580,7 +674,7 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) // @unlink($tmp_filename); $error = true; - $error_msg = (!empty($error_msg)) ? $error_msg."<br>The avatar image file size must more than 0 kB and less than ".round($board_config['avatar_filesize']/1024)." kB" : "The avatar image file size must more than 0 kB and less than ".round($board_config['avatar_filesize']/1024)." kB"; + $error_msg = (!empty($error_msg)) ? $error_msg . "<br>" . $lang['Avatar_imagesize'] : $lang['Avatar_imagesize']; } } else @@ -617,424 +711,45 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) $error = true; $error_msg = (!empty($error_msg)) ? $error_msg . "<br>The URL you entered is incomplete" : "The URL you entered is incomplete"; } - } + } // if ... allow_avatar_upload } + } - if(!$error) + if(!$error) + { + if($mode == "editprofile") { - - $sql = "UPDATE ".USERS_TABLE." - SET " . $username_sql . $passwd_sql . "user_email = '$email', user_icq = '$icq', user_website = '$website', user_occ = '$occupation', user_from = '$location', user_interests = '$interests', user_sig = '$signature', user_viewemail = $viewemail, user_aim = '$aim', user_yim = '$yim', user_msnm = '$msn', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify_pm = $notifypm, user_timezone = $user_timezone, user_dateformat = '$user_dateformat', user_lang = '$user_lang', user_template = '$user_template', user_theme = $user_theme".$avatar_sql." + $sql = "UPDATE " . USERS_TABLE . " + SET " . $username_sql . $passwd_sql . "user_email = '$email', user_icq = '$icq', user_website = '$website', user_occ = '$occupation', user_from = '$location', user_interests = '$interests', user_sig = '$signature', user_viewemail = $viewemail, user_aim = '$aim', user_yim = '$yim', user_msnm = '$msn', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify_pm = $notifypm, user_timezone = $user_timezone, user_dateformat = '$user_dateformat', user_lang = '$user_lang', user_template = '$user_template', user_theme = $user_theme" . $avatar_sql . " WHERE user_id = $user_id"; if($result = $db->sql_query($sql)) { - $msg = $l_infoupdated; - $template->set_filenames(array( - "reg_header" => "error_body.tpl" - )); - $template->assign_vars(array( - "ERROR_MESSAGE" => $msg - )); - $template->pparse("reg_header"); - - include('includes/page_tail.'.$phpEx); + message_die(GENERAL_MESSAGE, $lang['Profile_updated']); } else { - if(DEBUG) - { - $error = $db->sql_error(); - $error_msg = "Could not update the users table.<br>Reason: ".$error['message']."<br>Query: $sql"; - } - else - { - $error_msg = $l_dberror; - } - $template->set_filenames(array( - "reg_header" => "error_body.tpl" - )); - $template->assign_vars(array( - "ERROR_MESSAGE" => $error_msg - )); - $template->pparse("reg_header"); + message_die(GENERAL_ERROR, "Could not update users table", "", __LINE__, __FILE__, $sql); } } else { - $template->set_filenames(array( - "reg_header" => "error_body.tpl" - )); - $template->assign_vars(array( - "ERROR_MESSAGE" => $error_msg - )); - $template->pparse("reg_header"); - } - } - else - { - $user_id = $userdata['user_id']; - $username = $userdata['username']; - $email = $userdata['user_email']; - $password = ""; - $password_confirm = ""; - - $icq = $userdata['user_icq']; - $aim = $userdata['user_aim']; - $msn = $userdata['user_msnm']; - $yim = $userdata['user_yim']; - - $website = $userdata['user_website']; - $location = $userdata['user_from']; - $occupation = $userdata['user_occ']; - $interests = $userdata['user_interests']; - $signature = $userdata['user_sig']; - - $viewemail = $userdata['user_viewemail']; - $notifypm = $userdata['user_notify_pm']; - $attachsig = $userdata['user_attachsig']; - $allowhtml = $userdata['user_allowhtml']; - $allowbbcode = $userdata['user_allowbbcode']; - $allowsmilies = $userdata['user_allowsmile']; - $allowviewonline = $userdata['user_allow_viewonline']; - - $user_avatar = $userdata['user_avatar']; - $user_theme = $userdata['user_theme']; - $user_lang = $userdata['user_lang']; - $user_timezone = $userdata['user_timezone']; - $user_template = $userdata['user_template']; - $user_dateformat = $userdata['user_dateformat']; - } - - $s_hidden_fields = '<input type="hidden" name="user_id" value="' . $userdata['user_id'] . '"><input type="hidden" name="mode" value="' . $mode . '"><input type="hidden" name="agreed" value="true"><input type="hidden" name="coppa" value="0">'; - - $template->set_filenames(array( - "body" => "profile_add_body.tpl", - "jumpbox" => "jumpbox.tpl") - ); - $jumpbox = make_jumpbox(); - $template->assign_vars(array( - "JUMPBOX_LIST" => $jumpbox, - "SELECT_NAME" => POST_FORUM_URL) - ); - $template->assign_var_from_handle("JUMPBOX", "jumpbox"); - $template->assign_vars(array( - "USERNAME" => stripslashes($username), - "EMAIL" => stripslashes($email), - "YIM" => stripslashes($yim), - "ICQ" => stripslashes($icq), - "MSN" => stripslashes($msn), - "AIM" => stripslashes($aim), - "OCCUPATION" => stripslashes($occupation), - "INTERESTS" => stripslashes($interests), - "LOCATION" => stripslashes($location), - "WEBSITE" => stripslashes($website), - "SIGNATURE" => stripslashes(str_replace("<br />", "\n", $signature)), - "VIEW_EMAIL_YES" => ($viewemail) ? "CHECKED" : "", - "VIEW_EMAIL_NO" => (!$viewemail) ? "CHECKED" : "", - "HIDE_USER_YES" => (!$allowviewonline) ? "CHECKED" : "", - "HIDE_USER_NO" => ($allowviewonline) ? "CHECKED" : "", - "NOTIFY_PM_YES" => ($notifypm) ? "CHECKED" : "", - "NOTIFY_PM_NO" => (!$notifypm) ? "CHECKED" : "", - "ALWAYS_ADD_SIGNATURE_YES" => ($attachsig) ? "CHECKED" : "", - "ALWAYS_ADD_SIGNATURE_NO" => (!$attachsig) ? "CHECKED" : "", - "ALWAYS_ALLOW_BBCODE_YES" => ($allowbbcode) ? "CHECKED" : "", - "ALWAYS_ALLOW_BBCODE_NO" => (!$allowbbcode) ? "CHECKED" : "", - "ALWAYS_ALLOW_HTML_YES" => ($allowhtml) ? "CHECKED" : "", - "ALWAYS_ALLOW_HTML_NO" => (!$allowhtml) ? "CHECKED" : "", - "ALWAYS_ALLOW_SMILIES_YES" => ($allowsmilies) ? "CHECKED" : "", - "ALWAYS_ALLOW_SMILIES_NO" => (!$allowsmilies) ? "CHECKED" : "", - "ALLOW_AVATAR" => $board_config['allow_avatar_upload'], - "AVATAR" => ($user_avatar != "") ? "<img src=\"".$board_config['avatar_path']."/$user_avatar\">" : "", - "AVATAR_SIZE" => $board_config['avatar_filesize'], - "LANGUAGE_SELECT" => language_select($user_lang), - "THEME_SELECT" => theme_select($user_theme), - "TIMEZONE_SELECT" => tz_select($user_timezone), - "DATE_FORMAT" => stripslashes($user_dateformat), - "TEMPLATE_SELECT" => template_select($user_template), - - "L_PASSWORD_IF_CHANGED" => $l_password_if_changed, - "L_PASSWORD_CONFIRM_IF_CHANGED" => $l_password_confirm_if_changed, - "L_SUBMIT" => $l_submit, - "L_ICQ_NUMBER" => $l_icq_number, - "L_MESSENGER" => $l_messenger, - "L_YAHOO" => $l_yahoo, - "L_WEBSITE" => $l_website, - "L_AIM" => $l_aim, - "L_LOCATION" => $l_from, - "L_OCCUPATION" => $l_occupation, - "L_BOARD_LANGUAGE" => $l_boardlang, - "L_BOARD_THEME" => $l_boardtheme, - "L_BOARD_TEMPLATE" => $l_boardtemplate, - "L_TIMEZONE" => $l_timezone, - "L_DATE_FORMAT" => $l_date_format, - "L_DATE_FORMAT_EXPLANATION" => $l_date_format_explanation, - "L_YES" => $l_yes, - "L_NO" => $l_no, - "L_INTERESTS" => $l_interests, - "L_USER_UNIQUE" => $l_useruniq, - "L_ALWAYS_ALLOW_SMILIES" => $l_alwayssmile, - "L_ALWAYS_ALLOW_BBCODE" => $l_alwaysbbcode, - "L_ALWAYS_ALLOW_HTML" => $l_alwayshtml, - "L_HIDE_USER" => $lang['Hide_user'], - "L_ALWAYS_ADD_SIGNATURE" => $l_alwayssig, - "L_AVATAR" => $lang['Avatar'], - "L_AVATAR_EXPLAIN" => $lang['Avatar_explain'], - "L_UPLOAD_AVATAR" => $lang['Upload_Avatar'], - "L_AVATAR_URL" => $lang['Avatar_URL'], - "L_AVATAR_GALLERY" => $lang['Avatar_gallery'], - "L_DELETE_AVATAR" => $lang['Delete_Image'], - "L_CURRENT_IMAGE" => $lang['Current_Image'], - "L_SIGNATURE" => $l_signature, - "L_SIGNATURE_EXPLAIN" => $l_sigexplain, - "L_NOTIFY_ON_PRIVMSG" => $lang['Notify_on_privmsg'], - "L_PREFERENCES" => $l_preferences, - "L_PUBLIC_VIEW_EMAIL" => $l_publicmail, - "L_ITEMS_REQUIRED" => $l_itemsreq, - "L_REGISTRATION_INFO" => $l_reginfo, - "L_PROFILE_INFO" => $l_profile_info, - "L_PROFILE_INFO_NOTICE" => $l_profile_info_notice, - "L_CONFIRM" => $l_confirm, - "L_EMAIL_ADDRESS" => $l_emailaddress, - - "S_HIDDEN_FIELDS" => $s_hidden_fields, - "S_PROFILE_ACTION" => append_sid("profile.$phpEx")) - ); - - $template->pparse("body"); - include('includes/page_tail.'.$phpEx); - - break; - - case 'register': - - $username = (!empty($HTTP_POST_VARS['username'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['username']))) : ""; - $email = (!empty($HTTP_POST_VARS['email'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['email']))) : ""; - $password = (!empty($HTTP_POST_VARS['password'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['password']))) : ""; - $password_confirm = (!empty($HTTP_POST_VARS['password_confirm'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['password_confirm']))) : ""; - - $icq = (!empty($HTTP_POST_VARS['icq'])) ? trim(strip_tags($HTTP_POST_VARS['icq'])) : ""; - $aim = (!empty($HTTP_POST_VARS['aim'])) ? trim(strip_tags($HTTP_POST_VARS['aim'])) : ""; - $msn = (!empty($HTTP_POST_VARS['msn'])) ? trim(strip_tags($HTTP_POST_VARS['msn'])) : ""; - $yim = (!empty($HTTP_POST_VARS['yim'])) ? trim(strip_tags($HTTP_POST_VARS['yim'])) : ""; - - $website = (!empty($HTTP_POST_VARS['website'])) ? trim(strip_tags($HTTP_POST_VARS['website'])) : ""; - $location = (!empty($HTTP_POST_VARS['location'])) ? trim(strip_tags($HTTP_POST_VARS['location'])) : ""; - $occupation = (!empty($HTTP_POST_VARS['occupation'])) ? trim(strip_tags($HTTP_POST_VARS['occupation'])) : ""; - $interests = (!empty($HTTP_POST_VARS['interests'])) ? trim($HTTP_POST_VARS['interests']) : ""; - $signature = (!empty($HTTP_POST_VARS['signature'])) ? trim($HTTP_POST_VARS['signature']) : ""; - - $viewemail = (!empty($HTTP_POST_VARS['viewemail'])) ? $HTTP_POST_VARS['viewemail'] : 0; - $notifypm = (!empty($HTTP_POST_VARS['notifypm'])) ? $HTTP_POST_VARS['notifypm'] : 1; - $attachsig = (!empty($HTTP_POST_VARS['attachsig'])) ? $HTTP_POST_VARS['attachsig'] : 0; - $allowhtml = (!empty($HTTP_POST_VARS['allowhtml'])) ? $HTTP_POST_VARS['allowhtml'] : $board_config['allow_html']; - $allowbbcode = (!empty($HTTP_POST_VARS['allowbbcode'])) ? $HTTP_POST_VARS['allowbbcode'] : $board_config['allow_bbcode']; - $allowsmilies = (!empty($HTTP_POST_VARS['allowsmilies'])) ? $HTTP_POST_VARS['allowsmilies'] : $board_config['allow_smilies']; - $allowviewonline = (!empty($HTTP_POST_VARS['allowviewonline'])) ? $HTTP_POST_VARS['allowviewonline'] : 1; - - $user_theme = ($HTTP_POST_VARS['theme']) ? $HTTP_POST_VARS['theme'] : $board_config['default_theme']; - $user_lang = ($HTTP_POST_VARS['language']) ? $HTTP_POST_VARS['language'] : $board_config['default_lang']; - $user_timezone = str_replace("+", "", (isset($HTTP_POST_VARS['timezone'])) ? $HTTP_POST_VARS['timezone'] : $board_config['default_timezone']); - $user_template = ($HTTP_POST_VARS['template']) ? $HTTP_POST_VARS['template'] : $board_config['default_template']; - $user_dateformat = ($HTTP_POST_VARS['dateformat']) ? trim($HTTP_POST_VARS['dateformat']) : $board_config['default_dateformat']; - - $user_avatar_loc = ($HTTP_POST_FILES['avatar']['tmp_name'] != "none") ? $HTTP_POST_FILES['avatar']['tmp_name'] : ""; - $user_avatar_name = (!empty($HTTP_POST_FILES['avatar']['name'])) ? $HTTP_POST_FILES['avatar']['name'] : ""; - $user_avatar_size = (!empty($HTTP_POST_FILES['avatar']['size'])) ? $HTTP_POST_FILES['avatar']['size'] : 0; - $user_avatar_type = (!empty($HTTP_POST_FILES['avatar']['type'])) ? $HTTP_POST_FILES['avatar']['type'] : ""; - - if(!$HTTP_POST_VARS['coppa'] && !$HTTP_GET_VARS['coppa']) - { - $coppa = 0; - } - else - { - $coppa = 1; - } - - list($hr, $min, $sec, $mon, $day, $year) = explode(",", gmdate("H,i,s,m,d,Y", time())); - $regdate = gmmktime($hr, $min, $sec, $mon, $day, $year); - - $pagetype = "register"; - $page_title = "$l_register"; - include('includes/page_header.'.$phpEx); - - if(!isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed'])) - { - // - // Load agreement template - // since user has not yet - // agreed to registration - // conditions/coppa - // - $template->set_filenames(array( - "body" => "agreement.tpl", - "jumpbox" => "jumpbox.tpl") - ); - $jumpbox = make_jumpbox(); - $template->assign_vars(array( - "JUMPBOX_LIST" => $jumpbox, - "SELECT_NAME" => POST_FORUM_URL) - ); - $template->assign_var_from_handle("JUMPBOX", "jumpbox"); - $template->assign_vars(array( - "COPPA" => $coppa, - - "U_AGREE_OVER13" => append_sid("profile.$phpEx?mode=register&agreed=true"), - "U_AGREE_UNDER13" => append_sid("profile.$phpEx?mode=register&agreed=true&coppa=true")) - ); - $template->pparse("body"); - - include('includes/page_tail.'.$phpEx); - } - else - { - if(isset($HTTP_POST_VARS['submit'])) - { - $error = FALSE; - if(empty($username) || empty($password) || empty($password_confirm) || empty($email)) - { - $error = TRUE; - $error_msg = $l_notfilledin; - } - if(!validate_username($username)) - { - $error = TRUE; - if(isset($error_msg)) - { - $error_msg .= "<br />"; - } - $error_msg .= $l_invalidname; - } - if($password != $password_confirm) + if(SQL_LAYER != "mssql") { - $error = TRUE; - if(isset($error_msg)) - { - $error_msg .= "<br />"; - } - $error_msg .= $l_mismatch; + $user_id_sql = "user_id,"; + $user_id_value = $new_user_id . ", "; } - - // - // Do a ban check on this email address - // - $sql = "SELECT ban_email - FROM " . BANLIST_TABLE; - if(!$result = $db->sql_query($sql)) + else { - error_die(QUERY_ERROR, "Couldn't obtain email ban list information.", __LINE__, __FILE__); + $user_id_sql = ""; + $user_id_value = ""; } - $ban_email_list = $db->sql_fetchrowset($result); - for($i = 0; $i < count($ban_email_list); $i++) - { - if( eregi("^".$ban_email_list[$i]['ban_email']."$", $email) ) - { - $error = TRUE; - if(isset($error_msg)) - { - $error_msg .= "<br />"; - } - $error_msg .= $lang['Sorry_banned_email']; - } - } - } - // - // The AUTO_INCREMENT field in MySQL v3.23 doesn't work - // correctly when there is a row with -1 in that field - // so we have to explicitly get the next user ID. - // - $sql = "SELECT MAX(user_id) AS total - FROM ".USERS_TABLE; - if($result = $db->sql_query($sql)) - { - $user_id_row = $db->sql_fetchrow($result); - $new_user_id = $user_id_row['total'] + 1; - unset($result); - unset($user_id_row); - } - else - { - error_die(SQL_QUERY, "Couldn't obtained next user_id information.", __LINE__, __FILE__); - } + $sql = "INSERT INTO " . USERS_TABLE . " (" . $user_id_sql . "username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_avatar, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify_pm, user_timezone, user_dateformat, user_lang, user_template, user_theme, user_level, user_allow_pm, user_active, user_actkey) + VALUES (" . $user_id_value . "'$username', $regdate, '$password', '$email', '$icq', '$website', '$occupation', '$location', '$interests', '$signature', '$avatar_filename', $viewemail, '$aim', '$yim', '$msn', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifypm, $user_timezone, '$user_dateformat', '$user_lang', '$user_template', $user_theme, 0, 1, "; - $avatar_filename = ""; - if($board_config['allow_avatar_upload'] && !$error) - { - if(!empty($user_avatar_loc)) - { - if(file_exists($user_avatar_loc) && ereg(".jpg$|.gif$|.png$", $user_avatar_name)) - { - if($user_avatar_size <= $board_config['avatar_filesize'] && $avatar_size > 0) - { - $error_type = false; - switch($user_avatar_type) - { - case "image/pjpeg": - $imgtype = '.jpg'; - break; - case "image/gif": - $imgtype = '.gif'; - break; - case "image/png": - $imgtype = '.png'; - break; - default: - $error_type = true; - break; - } - - if(!$error_type) - { - list($width, $height) = getimagesize($user_avatar_loc); - - if( $width <= $board_config['avatar_max_width'] && - $height <= $board_config['avatar_max_height'] ) - { - $avatar_filename = $new_user_id . $imgtype; - - if(file_exists("./" . $board_config['avatar_path'] . "/" . $new_user_id)) - { - @unlink("./" . $board_config['avatar_path'] . "/" . $new_user_id); - } - @copy($user_avatar_loc, "./" . $board_config['avatar_path'] . "/$avatar_filename"); - $avatar_sql = ", user_avatar = '$avatar_filename'"; - } - else - { - $error = true; - $error_msg = (!empty($error_msg)) ? $error_msg . "<br>The avatar must be less than " . $board_config['avatar_max_width'] . " pixels wide and " . $board_config['avatar_max_height'] . " pixels high" : "The avatar must be less than " . $board_config['avatar_max_width'] . " pixels wide and " . $board_config['avatar_max_height'] . " pixels high"; - } - } - else - { - $error = true; - $error_msg = (!empty($error_msg)) ? $error_msg."<br>The avatar filetype must be .jpg, .gif or .png" : "The avatar filetype must be .jpg, .gif or .png"; - } - } - else - { - $error = true; - $error_msg = (!empty($error_msg)) ? $error_msg."<br>The avatar image file size must more than 0 kB and less than ".round($board_config['avatar_filesize']/1024)." kB" : "The avatar image file size must more than 0 kB and less than ".round($board_config['avatar_filesize']/1024)." kB"; - } - } - else - { - $error = true; - $error_msg = (!empty($error_msg)) ? $error_msg."<br>The avatar filetype must be .jpg, .gif or .png" : "The avatar filetype must be .jpg, .gif or .png"; - } - } - } - - if(isset($HTTP_POST_VARS['submit']) && !$error) - { - - $md_pass = md5($password); - $sql = "INSERT INTO ".USERS_TABLE." (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_avatar, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify_pm, user_timezone, user_dateformat, user_lang, user_template, user_theme, user_level, user_active, user_actkey) - VALUES ($new_user_id, '$username', '$regdate', '$md_pass', '$email', '$icq', '$website', '$occupation', '$location', '$interests', '$signature', '$avatar_filename', '$viewemail', '$aim', '$yim', '$msn', $attachsig, $allowsmilies, '$allowhtml', $allowbbcode, $allowviewonline, $notifypm, $user_timezone, '$user_dateformat', '$user_lang', '$user_template', $user_theme, 0, "; - if($require_activation || $coppa == 1) + if($board_config['require_activation'] || $coppa == 1) { $act_key = generate_activation_key(); $sql .= "0, '$act_key')"; @@ -1044,211 +759,242 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) $sql .= "1, '')"; } - if($result = $db->sql_query($sql)) + if($result = $db->sql_query($sql, BEGIN_TRANSACTION)) { - $sql = "INSERT INTO ".GROUPS_TABLE." - (group_name, group_description, group_single_user) - VALUES - ('$username', 'Personal User', 1)"; + $sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user, group_moderator) + VALUES ('$username', 'Personal User', 1, 0)"; if($result = $db->sql_query($sql)) { $group_id = $db->sql_nextid(); - $sql = "INSERT INTO ".USER_GROUP_TABLE." - (user_id, group_id) - VALUES - ($new_user_id, $group_id)"; - if($result = $db->sql_query($sql)) + $sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending) + VALUES ($new_user_id, $group_id, 0)"; + if($result = $db->sql_query($sql, END_TRANSACTION)) { - if($require_activation) + if($board_config['require_activation']) { - $msg = $l_accountinactive; - $email_msg = $l_welcomeemailactivate; + $msg = $lang['Account_inactive']; + $email_msg = $lang['Welcome_email_activate']; } else if($coppa) { - $msg = $l_coppa; - $email_msg = $l_welcomecoppa; + $msg = $lang['COPPA']; + $email_msg = $lang['Welcome_COPPA']; } else { - $msg = $l_acountadded; - $email_msg = $l_welcomemail; + $msg = $lang['Account_added']; //$l_acountadded; + $email_msg = $lang['Welcome_email']; //$l_welcomemail; } if(!$coppa) { $email_msg .= "\r\n" . $board_config['board_email']; - mail($email, $l_welcomesubj, $email_msg, "From: ".$board_config['board_email_from']."\r\n"); + $email_headers = "From: " . $board_config['board_email_from'] . "\r\n"; + + if($board_config['smtp_delivery'] && $board_config['smtp_host'] != "") + { + include('includes/smtp.'.$phpEx); + smtpmail($email, $lang['Welcome_subject'], $email_msg, $email_headers); + } + else + { + mail($email, $lang['Welcome_subject'], $email_msg, $email_headers); + } } - $template->set_filenames(array( - "reg_header" => "error_body.tpl" - )); - $template->assign_vars(array( - "ERROR_MESSAGE" => $msg - )); - $template->pparse("reg_header"); - - include('includes/page_tail.'.$phpEx); + message_die(GENERAL_MESSAGE, $msg); } else { - $error = TRUE; - $err = $db->sql_error(); - $error_msg = "Query Error: ".$err["message"]; - if(DEBUG) - { - $error_msg .= "<br>Query: $sql"; - } + message_die(GENERAL_ERROR, "Couldn't insert data into user_group table", "", __LINE__, __FILE__, $sql); } } else { - $error = TRUE; - $err = $db->sql_error(); - $error_msg = "Query Error: ".$err["message"]; - if(DEBUG) - { - $error_msg .= "<br>Query: $sql"; - } + message_die(GENERAL_ERROR, "Couldn't insert data into groups table", "", __LINE__, __FILE__, $sql); } } else { - $error = TRUE; - $err = $db->sql_error(); - $error_msg = "Query Error: ".$err["message"]; - if(DEBUG) - { - $error_msg .= "<br>Query: $sql"; - } + message_die(GENERAL_ERROR, "Couldn't insert data into users table", "", __LINE__, __FILE__, $sql); } - } - - if($error) - { - $template->set_filenames(array( - "reg_header" => "error_body.tpl" - )); - $template->assign_vars(array( - "ERROR_MESSAGE" => $error_msg - )); - $template->pparse("reg_header"); - } - if(!isset($coppa)) - { - $coppa = FALSE; - } - - if(!isset($user_template)) - { - $selected_template = $board_config['default_template']; - } - - $s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '"><input type="hidden" name="agreed" value="true"><input type="hidden" name="coppa" value="' . $coppa . '">'; - - // - // Load profile_add template - // to allow user to insert - // new user reg details - // + } // if mode == register + } + else + { $template->set_filenames(array( - "body" => "profile_add_body.tpl", - "jumpbox" => "jumpbox.tpl") + "reg_header" => "error_body.tpl") ); - $jumpbox = make_jumpbox(); $template->assign_vars(array( - "JUMPBOX_LIST" => $jumpbox, - "SELECT_NAME" => POST_FORUM_URL) + "ERROR_MESSAGE" => $error_msg) ); - $template->assign_var_from_handle("JUMPBOX", "jumpbox"); - $template->assign_vars(array( - "USERNAME" => stripslashes($username), - "EMAIL" => stripslashes($email), - "YIM" => stripslashes($yim), - "ICQ" => stripslashes($icq), - "MSN" => stripslashes($msn), - "AIM" => stripslashes($aim), - "OCCUPATION" => stripslashes($occupation), - "INTERESTS" => stripslashes($interests), - "LOCATION" => stripslashes($location), - "WEBSITE" => stripslashes($website), - "SIGNATURE" => stripslashes($signature), - "VIEW_EMAIL_YES" => ($viewemail) ? "CHECKED" : "", - "VIEW_EMAIL_NO" => (!$viewemail) ? "CHECKED" : "", - "HIDE_USER_YES" => (!$allowviewonline) ? "CHECKED" : "", - "HIDE_USER_NO" => ($allowviewonline) ? "CHECKED" : "", - "NOTIFY_PM_YES" => ($notifypm) ? "CHECKED" : "", - "NOTIFY_PM_NO" => (!$notifypm) ? "CHECKED" : "", - "ALWAYS_ADD_SIGNATURE_YES" => ($attachsig) ? "CHECKED" : "", - "ALWAYS_ADD_SIGNATURE_NO" => (!$attachsig) ? "CHECKED" : "", - "ALWAYS_ALLOW_BBCODE_YES" => ($allowbbcode) ? "CHECKED" : "", - "ALWAYS_ALLOW_BBCODE_NO" => (!$allowbbcode) ? "CHECKED" : "", - "ALWAYS_ALLOW_HTML_YES" => ($allowhtml) ? "CHECKED" : "", - "ALWAYS_ALLOW_HTML_NO" => (!$allowhtml) ? "CHECKED" : "", - "ALWAYS_ALLOW_SMILIES_YES" => ($allowsmilies) ? "CHECKED" : "", - "ALWAYS_ALLOW_SMILIES_NO" => (!$allowsmilies) ? "CHECKED" : "", - "ALLOW_AVATAR" => $board_config['allow_avatar_upload'], - "LANGUAGE_SELECT" => language_select($user_lang), - "THEME_SELECT" => theme_select($user_theme), - "TIMEZONE_SELECT" => tz_select($user_timezone), - "DATE_FORMAT" => stripslashes($user_dateformat), - "TEMPLATE_SELECT" => template_select($user_template), - - "L_SUBMIT" => $l_submit, - "L_ICQ_NUMBER" => $l_icq_number, - "L_MESSENGER" => $l_messenger, - "L_YAHOO" => $l_yahoo, - "L_WEBSITE" => $l_website, - "L_AIM" => $l_aim, - "L_LOCATION" => $l_from, - "L_OCCUPATION" => $l_occupation, - "L_BOARD_LANGUAGE" => $l_boardlang, - "L_BOARD_THEME" => $l_boardtheme, - "L_BOARD_TEMPLATE" => $l_boardtemplate, - "L_TIMEZONE" => $l_timezone, - "L_DATE_FORMAT" => $l_date_format, - "L_DATE_FORMAT_EXPLANATION" => $l_date_format_explanation, - "L_YES" => $l_yes, - "L_NO" => $l_no, - "L_INTERESTS" => $l_interests, - "L_USER_UNIQUE" => $l_useruniq, - "L_ALWAYS_ALLOW_SMILIES" => $l_alwayssmile, - "L_ALWAYS_ALLOW_BBCODE" => $l_alwaysbbcode, - "L_ALWAYS_ALLOW_HTML" => $l_alwayshtml, - "L_HIDE_USER" => $lang['Hide_user'], - "L_ALWAYS_ADD_SIGNATURE" => $l_alwayssig, - "L_AVATAR_EXPLAIN" => $lang['Avatar_explain'], - "L_UPLOAD_AVATAR" => $lang['Upload_Avatar'], - "L_AVATAR_URL" => $lang['Avatar_URL'], - "L_AVATAR_GALLERY" => $lang['Avatar_gallery'], - "L_DELETE_AVATAR" => $lang['Delete_Image'], - "L_CURRENT_IMAGE" => $lang['Current_Image'], - "L_SIGNATURE" => $l_signature, - "L_SIGNATURE_EXPLAIN" => $l_sigexplain, - "L_NOTIFY_ON_PRIVMSG" => $lang['Notify_on_privmsg'], - "L_PREFERENCES" => $l_preferences, - "L_PUBLIC_VIEW_EMAIL" => $l_publicmail, - "L_ITEMS_REQUIRED" => $l_itemsreq, - "L_REGISTRATION_INFO" => $l_reginfo, - "L_PROFILE_INFO" => $l_profile_info, - "L_PROFILE_INFO_NOTICE" => $l_profile_info_notice, - "L_CONFIRM" => $l_confirm, - "L_EMAIL_ADDRESS" => $l_emailaddress, - - "S_HIDDEN_FIELDS" => $s_hidden_fields, - "S_PROFILE_ACTION" => append_sid("profile.$phpEx")) - ); - - $template->pparse("body"); - include('includes/page_tail.'.$phpEx); + $template->pparse("reg_header"); } - break; - case 'activate': + } + else if($mode == "editprofile") + { + $user_id = $userdata['user_id']; + $username = stripslashes($userdata['username']); + $email = $userdata['user_email']; + $password = ""; + $password_confirm = ""; + + $icq = $userdata['user_icq']; + $aim = stripslashes($$userdata['user_aim']); + $msn = stripslashes($$userdata['user_msnm']); + $yim = stripslashes($$userdata['user_yim']); + + $website = stripslashes($$userdata['user_website']); + $location = stripslashes($$userdata['user_from']); + $occupation = stripslashes($$userdata['user_occ']); + $interests = stripslashes($$userdata['user_interests']); + $signature = stripslashes($userdata['user_sig']); + + $viewemail = $userdata['user_viewemail']; + $notifypm = $userdata['user_notify_pm']; + $attachsig = $userdata['user_attachsig']; + $allowhtml = $userdata['user_allowhtml']; + $allowbbcode = $userdata['user_allowbbcode']; + $allowsmilies = $userdata['user_allowsmile']; + $allowviewonline = $userdata['user_allow_viewonline']; + + $user_avatar = $userdata['user_avatar']; + $user_theme = $userdata['user_theme']; + $user_lang = $userdata['user_lang']; + $user_timezone = $userdata['user_timezone']; + $user_template = $userdata['user_template']; + $user_dateformat = $userdata['user_dateformat']; + } - $sql = "SELECT user_id + if(!isset($coppa)) + { + $coppa = FALSE; + } + + if(!isset($user_template)) + { + $selected_template = $board_config['default_template']; + } + + $s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '"><input type="hidden" name="agreed" value="true"><input type="hidden" name="coppa" value="' . $coppa . '">'; + if($mode == "editprofile") + { + $s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $userdata['user_id'] . '">'; + } + + $template->set_filenames(array( + "body" => "profile_add_body.tpl", + "jumpbox" => "jumpbox.tpl") + ); + + $jumpbox = make_jumpbox(); + $template->assign_vars(array( + "JUMPBOX_LIST" => $jumpbox, + "SELECT_NAME" => POST_FORUM_URL) + ); + $template->assign_var_from_handle("JUMPBOX", "jumpbox"); + + $template->assign_vars(array( + "USERNAME" => stripslashes($username), + "EMAIL" => stripslashes($email), + "YIM" => stripslashes($yim), + "ICQ" => stripslashes($icq), + "MSN" => stripslashes($msn), + "AIM" => stripslashes($aim), + "OCCUPATION" => stripslashes($occupation), + "INTERESTS" => stripslashes($interests), + "LOCATION" => stripslashes($location), + "WEBSITE" => stripslashes($website), + "SIGNATURE" => stripslashes(str_replace("<br />", "\n", $signature)), + "VIEW_EMAIL_YES" => ($viewemail) ? "CHECKED" : "", + "VIEW_EMAIL_NO" => (!$viewemail) ? "CHECKED" : "", + "HIDE_USER_YES" => (!$allowviewonline) ? "CHECKED" : "", + "HIDE_USER_NO" => ($allowviewonline) ? "CHECKED" : "", + "NOTIFY_PM_YES" => ($notifypm) ? "CHECKED" : "", + "NOTIFY_PM_NO" => (!$notifypm) ? "CHECKED" : "", + "ALWAYS_ADD_SIGNATURE_YES" => ($attachsig) ? "CHECKED" : "", + "ALWAYS_ADD_SIGNATURE_NO" => (!$attachsig) ? "CHECKED" : "", + "ALWAYS_ALLOW_BBCODE_YES" => ($allowbbcode) ? "CHECKED" : "", + "ALWAYS_ALLOW_BBCODE_NO" => (!$allowbbcode) ? "CHECKED" : "", + "ALWAYS_ALLOW_HTML_YES" => ($allowhtml) ? "CHECKED" : "", + "ALWAYS_ALLOW_HTML_NO" => (!$allowhtml) ? "CHECKED" : "", + "ALWAYS_ALLOW_SMILIES_YES" => ($allowsmilies) ? "CHECKED" : "", + "ALWAYS_ALLOW_SMILIES_NO" => (!$allowsmilies) ? "CHECKED" : "", + "ALLOW_AVATAR" => $board_config['allow_avatar_upload'], + "AVATAR" => ($user_avatar != "") ? "<img src=\"".$board_config['avatar_path']."/$user_avatar\">" : "", + "AVATAR_SIZE" => $board_config['avatar_filesize'], + "LANGUAGE_SELECT" => language_select($user_lang), + "THEME_SELECT" => theme_select($user_theme), + "TIMEZONE_SELECT" => tz_select($user_timezone), + "DATE_FORMAT" => stripslashes($user_dateformat), + "TEMPLATE_SELECT" => template_select($user_template), + + "L_PASSWORD_IF_CHANGED" => ($mode == "editprofile") ? $l_password_if_changed : "", + "L_PASSWORD_CONFIRM_IF_CHANGED" => ($mode == "editprofile") ? $l_password_confirm_if_changed : "", + "L_SUBMIT" => $lang['Submit'], + "L_RESET" => $lang['Reset'], + "L_ICQ_NUMBER" => $l_icq_number, + "L_MESSENGER" => $l_messenger, + "L_YAHOO" => $l_yahoo, + "L_WEBSITE" => $l_website, + "L_AIM" => $l_aim, + "L_LOCATION" => $l_from, + "L_OCCUPATION" => $l_occupation, + "L_BOARD_LANGUAGE" => $l_boardlang, + "L_BOARD_THEME" => $l_boardtheme, + "L_BOARD_TEMPLATE" => $l_boardtemplate, + "L_TIMEZONE" => $l_timezone, + "L_DATE_FORMAT" => $l_date_format, + "L_DATE_FORMAT_EXPLANATION" => $l_date_format_explanation, + "L_YES" => $lang['Yes'], + "L_NO" => $lang['No'], + "L_INTERESTS" => $l_interests, + "L_USER_UNIQUE" => $l_useruniq, + "L_ALWAYS_ALLOW_SMILIES" => $lang['Always_smile'], + "L_ALWAYS_ALLOW_BBCODE" => $lang['Always_bbcode'], + "L_ALWAYS_ALLOW_HTML" => $lang['Always_html'], + "L_HIDE_USER" => $lang['Hide_user'], + "L_ALWAYS_ADD_SIGNATURE" => $lang['Always_add_sig'], + + "L_AVATAR_PANEL" => $lang['Avatar_panel'], + "L_AVATAR_EXPLAIN" => $lang['Avatar_explain'], + "L_UPLOAD_AVATAR_FILE" => $lang['Upload_Avatar_file'], + "L_UPLOAD_AVATAR_URL" => $lang['Upload_Avatar_URL'], + "L_UPLOAD_AVATAR_URL_EXPLAIN" => $lang['Upload_Avatar_URL_explain'], + "L_AVATAR_GALLERY" => $lang['Avatar_gallery'], + "L_LINK_REMOTE_AVATAR" => $lang['Link_remote_Avatar'], + "L_LINK_REMOTE_AVATAR_EXPLAIN" => $lang['Link_remote_Avatar_explain'], + "L_DELETE_AVATAR" => $lang['Delete_Image'], + "L_CURRENT_IMAGE" => $lang['Current_Image'], + + "L_SIGNATURE" => $l_signature, + "L_SIGNATURE_EXPLAIN" => $l_sigexplain, + "L_NOTIFY_ON_PRIVMSG" => $lang['Notify_on_privmsg'], + "L_PREFERENCES" => $l_preferences, + "L_PUBLIC_VIEW_EMAIL" => $l_publicmail, + "L_ITEMS_REQUIRED" => $l_itemsreq, + "L_REGISTRATION_INFO" => $l_reginfo, + "L_PROFILE_INFO" => $l_profile_info, + "L_PROFILE_INFO_NOTICE" => $l_profile_info_notice, + "L_CONFIRM" => $l_confirm, + "L_EMAIL_ADDRESS" => $l_emailaddress, + + "S_ALLOW_AVATAR_UPLOAD" => $board_config['allow_avatar_upload'], + "S_ALLOW_AVATAR_LOCAL" => $board_config['allow_avatar_local'], + "S_ALLOW_AVATAR_REMOTE" => $board_config['allow_avatar_remote'], + "S_HIDDEN_FIELDS" => $s_hidden_fields, + "S_PROFILE_ACTION" => append_sid("profile.$phpEx")) + ); + + $template->pparse("body"); + + include('includes/page_tail.'.$phpEx); + } + else if($mode == "activate") + { + $sql = "SELECT user_id FROM " . USERS_TABLE . " WHERE user_actkey = '$act_key'"; if($result = $db->sql_query($sql)) @@ -1256,30 +1002,30 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) if($num = $db->sql_numrows($result)) { $rowset = $db->sql_fetchrowset($result); + $sql_update = "UPDATE " . USERS_TABLE . " SET user_active = 1, user_actkey = '' WHERE user_id = " . $rowset[0]['user_id']; if($result = $db->sql_query($sql_update)) { - error_die(GENERAL_ERROR, $l_nowactive); + message_die(GENERAL_MESSAGE, $lang['Account_active']); } else { - error_die(SQL_QUERY); + message_die(GENERAL_ERROR, "Couldn't update users table", "", __LINE__, __FILE__, $sql_update); } } else { - error_die(GENERAL_ERROR, $l_wrongactiv); + message_die(GENERAL_ERROR, $lang['']); //wrongactiv } } else { - error_die(SQL_QUERY); + message_die(GENERAL_ERROR, "Couldn't obtain user information", "", __LINE__, __FILE__, $sql); } - break; + break; } - } ?>
\ No newline at end of file |
