⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 acp_users.php

📁 这些都是我以前学习是用到的源码
💻 PHP
📖 第 1 页 / 共 5 页
字号:
								'user_sig_bbcode_bitfield'	=> ''							);							$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "								WHERE user_id = $user_id";							$db->sql_query($sql);													add_log('admin', 'LOG_USER_DEL_SIG', $user_row['username']);							add_log('user', $user_id, 'LOG_USER_DEL_SIG_USER');							trigger_error($user->lang['USER_ADMIN_SIG_REMOVED'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));						break;						case 'delavatar':														$sql_ary = array(								'user_avatar'			=> '',								'user_avatar_type'		=> 0,								'user_avatar_width'		=> 0,								'user_avatar_height'	=> 0,							);							$sql = 'UPDATE ' . USERS_TABLE . '								SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "								WHERE user_id = $user_id";							$db->sql_query($sql);							// Delete old avatar if present							if ($user_row['user_avatar'] && $user_row['user_avatar_type'] != AVATAR_GALLERY)							{								avatar_delete('user', $user_row);							}							add_log('admin', 'LOG_USER_DEL_AVATAR', $user_row['username']);							add_log('user', $user_id, 'LOG_USER_DEL_AVATAR_USER');							trigger_error($user->lang['USER_ADMIN_AVATAR_REMOVED'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));						break;						case 'delposts':							if (confirm_box(true))							{								$sql = 'SELECT topic_id, COUNT(post_id) AS total_posts									FROM ' . POSTS_TABLE . "									WHERE poster_id = $user_id									GROUP BY topic_id";								$result = $db->sql_query($sql);								$topic_id_ary = array();								while ($row = $db->sql_fetchrow($result))								{									$topic_id_ary[$row['topic_id']] = $row['total_posts'];								}								$db->sql_freeresult($result);								if (sizeof($topic_id_ary))								{									$sql = 'SELECT topic_id, topic_replies, topic_replies_real										FROM ' . TOPICS_TABLE . '										WHERE ' . $db->sql_in_set('topic_id', array_keys($topic_id_ary));									$result = $db->sql_query($sql);									$del_topic_ary = array();									while ($row = $db->sql_fetchrow($result))									{										if (max($row['topic_replies'], $row['topic_replies_real']) + 1 == $topic_id_ary[$row['topic_id']])										{											$del_topic_ary[] = $row['topic_id'];										}									}									$db->sql_freeresult($result);									if (sizeof($del_topic_ary))									{										$sql = 'DELETE FROM ' . TOPICS_TABLE . '											WHERE ' . $db->sql_in_set('topic_id', $del_topic_ary);										$db->sql_query($sql);									}								}								// Delete posts, attachments, etc.								delete_posts('poster_id', $user_id);								add_log('admin', 'LOG_USER_DEL_POSTS', $user_row['username']);								trigger_error($user->lang['USER_POSTS_DELETED'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));							}							else							{								confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(									'u'				=> $user_id,									'i'				=> $id,									'mode'			=> $mode,									'action'		=> $action,									'update'		=> true))								);							}						break;						case 'delattach':							if (confirm_box(true))							{								delete_attachments('user', $user_id);								add_log('admin', 'LOG_USER_DEL_ATTACH', $user_row['username']);								trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));							}							else							{								confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(									'u'				=> $user_id,									'i'				=> $id,									'mode'			=> $mode,									'action'		=> $action,									'update'		=> true))								);							}												break;												case 'moveposts':															$new_forum_id = request_var('new_f', 0);							if (!$new_forum_id)							{								$this->page_title = 'USER_ADMIN_MOVE_POSTS';								$template->assign_vars(array(									'S_SELECT_FORUM'		=> true,									'U_ACTION'				=> $this->u_action . "&amp;action=$action&amp;u=$user_id",									'U_BACK'				=> $this->u_action . "&amp;u=$user_id",									'S_FORUM_OPTIONS'		=> make_forum_select(false, false, false, true))								);								return;							}							// Two stage?							// Move topics comprising only posts from this user							$topic_id_ary = $move_topic_ary = $move_post_ary = $new_topic_id_ary = array();							$forum_id_ary = array($new_forum_id);							$sql = 'SELECT topic_id, COUNT(post_id) AS total_posts								FROM ' . POSTS_TABLE . "								WHERE poster_id = $user_id									AND forum_id <> $new_forum_id								GROUP BY topic_id";							$result = $db->sql_query($sql);							while ($row = $db->sql_fetchrow($result))							{								$topic_id_ary[$row['topic_id']] = $row['total_posts'];							}							$db->sql_freeresult($result);							if (sizeof($topic_id_ary))							{								$sql = 'SELECT topic_id, forum_id, topic_title, topic_replies, topic_replies_real									FROM ' . TOPICS_TABLE . '									WHERE ' . $db->sql_in_set('topic_id', array_keys($topic_id_ary));								$result = $db->sql_query($sql);								while ($row = $db->sql_fetchrow($result))								{									if (max($row['topic_replies'], $row['topic_replies_real']) + 1 == $topic_id_ary[$row['topic_id']])									{										$move_topic_ary[] = $row['topic_id'];									}									else									{										$move_post_ary[$row['topic_id']]['title'] = $row['topic_title'];										$move_post_ary[$row['topic_id']]['attach'] = ($row['attach']) ? 1 : 0;									}									$forum_id_ary[] = $row['forum_id'];								}								$db->sql_freeresult($result);							}							// Entire topic comprises posts by this user, move these topics							if (sizeof($move_topic_ary))							{								move_topics($move_topic_ary, $new_forum_id, false);							}							if (sizeof($move_post_ary))							{								// Create new topic								// Update post_ids, report_ids, attachment_ids								foreach ($move_post_ary as $topic_id => $post_ary)								{									// Create new topic									$sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', array(										'topic_poster'				=> $user_id,										'topic_time'				=> time(),										'forum_id' 					=> $new_forum_id,										'icon_id'					=> 0,										'topic_approved'			=> 1,										'topic_title' 				=> $post_ary['title'],										'topic_first_poster_name'	=> $user_row['username'],										'topic_type'				=> POST_NORMAL,										'topic_time_limit'			=> 0,										'topic_attachment'			=> $post_ary['attach'])									);									$db->sql_query($sql);									$new_topic_id = $db->sql_nextid();									// Move posts									$sql = 'UPDATE ' . POSTS_TABLE . "										SET forum_id = $new_forum_id, topic_id = $new_topic_id										WHERE topic_id = $topic_id											AND poster_id = $user_id";									$db->sql_query($sql);									if ($post_ary['attach'])									{										$sql = 'UPDATE ' . ATTACHMENTS_TABLE . "											SET topic_id = $new_topic_id											WHERE topic_id = $topic_id												AND poster_id = $user_id";										$db->sql_query($sql);									}									$new_topic_id_ary[] = $new_topic_id;								}							}							$forum_id_ary = array_unique($forum_id_ary);							$topic_id_ary = array_unique(array_merge($topic_id_ary, $new_topic_id_ary));							if (sizeof($topic_id_ary))							{								sync('reported', 'topic_id', $topic_id_ary);								sync('topic', 'topic_id', $topic_id_ary);							}							if (sizeof($forum_id_ary))							{								sync('forum', 'forum_id', $forum_id_ary);							}							$sql = 'SELECT forum_name								FROM ' . FORUMS_TABLE . "								WHERE forum_id = $new_forum_id";							$result = $db->sql_query($sql, 3600);							$forum_info = $db->sql_fetchrow($result);							$db->sql_freeresult($result);							add_log('admin', 'LOG_USER_MOVE_POSTS', $user_row['username'], $forum_info['forum_name']);							add_log('user', $user_id, 'LOG_USER_MOVE_POSTS_USER', $forum_info['forum_name']);							trigger_error($user->lang['USER_POSTS_MOVED'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));						break;					}					// Handle registration info updates					$data = array(						'username'			=> request_var('user', $user_row['username'], true),						'user_founder'		=> request_var('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0),						'email'				=> strtolower(request_var('user_email', $user_row['user_email'])),						'email_confirm'		=> strtolower(request_var('email_confirm', '')),						'user_password'		=> request_var('user_password', '', true),						'password_confirm'	=> request_var('password_confirm', '', true),						'warnings'			=> request_var('warnings', $user_row['user_warnings']),					);					// Validation data - we do not check the password complexity setting here					$check_ary = array(						'user_password'		=> array(							array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),							array('password')),						'password_confirm'	=> array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),						'warnings'			=> array('num'),					);					// Check username if altered					if ($data['username'] != $user_row['username'])					{						$check_ary += array(							'username'			=> array(								array('string', false, $config['min_name_chars'], $config['max_name_chars']),								array('username', $user_row['username'])),						);					}					// Check email if altered					if ($data['email'] != $user_row['user_email'])					{						$check_ary += array(							'email'				=> array(								array('string', false, 6, 60),								array('email', $user_row['user_email'])								), 							'email_confirm'		=> array('string', true, 6, 60)						);					}					$error = validate_data($data, $check_ary);					if ($data['user_password'] && $data['password_confirm'] != $data['user_password'])					{						$error[] = 'NEW_PASSWORD_ERROR';					}					if ($data['email'] != $user_row['user_email'] && $data['email_confirm'] != $data['email'])					{						$error[] = 'NEW_EMAIL_ERROR';					}					// Which updates do we need to do?					$update_warning = ($user_row['user_warnings'] != $data['warnings']) ? true : false;					$update_username = ($user_row['username'] != $data['username']) ? $data['username'] : false;					$update_password = ($data['user_password'] && $user_row['user_password'] != md5($data['user_password'])) ? true : false;					$update_email = ($data['email'] != $user_row['user_email']) ? $data['email'] : false;					if (!sizeof($error))					{						$sql_ary = array();						if ($user_row['user_type'] != USER_FOUNDER || $user->data['user_type'] == USER_FOUNDER)						{							if ($update_warning)							{								$sql_ary['user_warnings'] = $data['warnings'];							}							// Only allow founders updating the founder status...							if ($user->data['user_type'] == USER_FOUNDER)							{								// Setting a normal member to be a founder								if ($data['user_founder'] && $user_row['user_type'] != USER_FOUNDER)								{									// Make sure the user is not setting an Inactive or ignored user to be a founder									if ($user_row['user_type'] == USER_IGNORE)									{										trigger_error($user->lang['CANNOT_SET_FOUNDER_BOT'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);									}									if ($user_row['user_type'] == USER_INACTIVE)									{										trigger_error($user->lang['CANNOT_SET_FOUNDER_INACTIVE'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);									}									$sql_ary['user_type'] = USER_FOUNDER;								}								else if (!$data['user_founder'] && $user_row['user_type'] == USER_FOUNDER)								{									// Check if at least one founder is present									$sql = 'SELECT user_id										FROM ' . USERS_TABLE . '										WHERE user_type = ' . USER_FOUNDER . '

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -