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

📄 usercp.php

📁 极限网络智能办公系统—MYOA26—100%—源程序。
💻 PHP
📖 第 1 页 / 共 4 页
字号:
			}
			else
			{
				$rpgnameoptions = "In battle.";
				$classoptions = "<option value=\"{$user['rpgclass']}\" DISABLED>You are in battle.</option>";
				$raceoptions = "<option value=\"{$user['rpgrace']}\" DISABLED>You are in battle.</option>";
				$alignmentoptions = "<option value=\"al{$user['alignment']}\" DISABLED>You are in battle.</option>";
				$elementoptions = "<option value=\"{$user['element']}\" DISABLED>You are in battle.</option>";
				$genderoptions = "<option value=\"gd{$user['rpggender']}\" DISABLED>You are in battle.</option>";
				$rpgtypename = "In battle.";
				$rpgtypeid = $user['rpgtype'];
			}
			$this->output .= $this->html->rpgprofile_javascript( $racearrays, $classarrays, $typearrays );
			$this->output .= $this->html->rpgprofile( $rpgnameoptions, $classoptions, $raceoptions, $alignmentoptions, $elementoptions, $genderoptions, $rpgtypename, $rpgtypeid );
		}
		else
		{
			$DB->query( "SELECT * FROM ibf_rpg_element WHERE elementid='".$user['alignment']."'" );
			$get_elem = $DB->fetch_row( );
			$DB->query( "SELECT * FROM ibf_rpg_alignment WHERE id='".$user['alignment']."'" );
			$get_align = $DB->fetch_row( );
			$DB->query( "SELECT * FROM ibf_rpg_race WHERE raceid='".$user['rpgrace']."'" );
			$get_race = $DB->fetch_row( );
			if ( $user['rgpgender'] == 1 )
			{
				$rpg_gender = "Female";
				$class_db = "ibf_rpg_classf";
				$gender_icon = "female";
			}
			else
			{
				$rpg_gender = "Male";
				$class_db = "ibf_rpg_classm";
				$gender_icon = "male";
			}
			$DB->query( "SELECT * FROM {$class_db} WHERE id='".$user['rpgclass']."'" );
			$get_class = $DB->fetch_row( );
			$rpg_job = "<img src=\"html/rpg/classes/{$gender_icon}/".$user['icon']."\" alt=\"".$get_class['name']."\">";
			$rpg_name = $user['rpgname'];
			$rpg_element = $get_elem['name'];
			$rpg_alignment = $get_align['name'];
			$rpg_race = $get_race['name'];
			$rpg_class = $get_class['name'];
			$rpg_typename = $get_class['typename'];
			$this->output .= $this->html->rpgprofile_view( $rpg_job, $rpg_name, $rpg_class, $rpg_race, $rpg_alignment, $rpg_element, $rpg_gender, $rpg_typename );
		}
		$this->page_title = $ibforums->lang['t_welcome'];
		$this->nav = array(
			"<a href='".$this->base_url."&act=UserCP&CODE=00'>".$ibforums->lang['t_title']."</a>"
		);
	}

	function do_rpg_profile( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		$DB->query( "SELECT * FROM ibf_members WHERE id='".$this->member['id']."'" );
		$get_member = $DB->fetch_row( );
		$DB->query( "SELECT * FROM ibf_rpg_element WHERE elementid='".$ibforums->input['element']."'" );
		$get_element = $DB->fetch_row( );
		$updatehp = $get_element['hp'] + $get_member['hp'];
		$updatemaxhp = $get_element['hp'] + $get_member['maxhp'];
		$updatema = $get_element['ma'] + $get_member['ma'];
		$updatemaxma = $get_element['ma'] + $get_member['maxma'];
		$updatepp = $get_element['pp'] + $get_member['pp'];
		$updatemaxpp = $get_element['pp'] + $get_member['maxpp'];
		$updateap = $get_element['ap'] + $get_member['ap'];
		$DB->query( "SELECT * FROM ibf_rpg_race WHERE raceid='".$ibforums->input['rpgrace']."'" );
		$get_race = $DB->fetch_row( );
		if ( $ibforums->input['rpggender'] == "gd1" )
		{
			$dbclass = "ibf_rpg_classf";
			$rpg_gender = "1";
		}
		else if ( $ibforums->input['rpggender'] == "gd2" )
		{
			$dbclass = "ibf_rpg_classm";
			$rpg_gender = "2";
		}
		$DB->query( "SELECT * FROM {$dbclass} WHERE id='".$ibforums->input['rpgclass']."'" );
		$get_class = $DB->fetch_row( );
		$updateregatt = $get_race['regatt'] + $get_class['regatt'];
		$updateregdef = $get_race['regdef'] + $get_class['regdef'];
		$updatemagicatt = $get_race['magicatt'] + $get_class['magicatt'];
		$updatemagicdef = $get_race['magicdef'] + $get_class['magicdef'];
		$updatespeed = $get_race['speed'] + $get_class['speed'];
		$updateevade = $get_race['evade'] + $get_class['evade'];
		$DB->query( "SELECT * FROM ibf_rpg_alignment WHERE alignid='".$ibforums->input['alignment']."'" );
		$get_align = $DB->fetch_row( );
		$db_string = $DB->compile_db_update_string( array(
			"rpgname" => $ibforums->input['rpgname'],
			"rpgclass" => $ibforums->input['rpgclass'],
			"rpgrace" => $ibforums->input['rpgrace'],
			"alignment" => $get_align['id'],
			"rpgtype" => $ibforums->input['rpgtypename'],
			"rpggender" => $rpg_gender,
			"hp" => $updatehp,
			"maxhp" => $updatemaxhp,
			"ma" => $updatema,
			"maxma" => $updatemaxma,
			"pp" => $updatepp,
			"maxpp" => $updatemaxpp,
			"ap" => $updateap,
			"element" => $ibforums->input['element'],
			"type" => $get_class['type'],
			"level" => 1,
			"icon" => $get_class['icon'],
			"regatt" => $updateregatt,
			"regdef" => $updateregdef,
			"magicatt" => $updatemagicatt,
			"magicdef" => $updatemagicdef,
			"speed" => $updatespeed,
			"evade" => $updateevade
		) );
		$DB->query( "UPDATE ibf_members SET {$db_string} WHERE id='".$this->member['id']."'" );
		$print->redirect_screen( $ibforums->lang['rpg_profile_update'], "act=UserCP&CODE=100" );
	}

	function remove_forum_tracker( )
	{
		global $ibforums;
		global $std;
		global $DB;
		if ( $ibforums->input['f'] == "all" )
		{
			$DB->query( "DELETE FROM ibf_forum_tracker WHERE member_id='".$this->member['id']."'" );
		}
		else
		{
			$id = intval( $ibforums->input['f'] );
			$DB->query( "DELETE FROM ibf_forum_tracker WHERE member_id='".$this->member['id']."' AND forum_id='{$id}'" );
		}
		$std->boink_it( $this->base_url."&act=UserCP&CODE=50" );
	}

	function forum_tracker( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		$this->output .= $this->html->forum_subs_header( );
		$DB->query( "SELECT t.frid, t.start_date, f.*, c.id as cat_id, c.name as cat_name\r\n \t\t            FROM ibf_forum_tracker t\r\n \t\t             LEFT JOIN ibf_forums f ON (t.forum_id=f.id)\r\n \t\t             LEFT JOIN ibf_categories c ON (c.id=f.category)\r\n \t\t            WHERE t.member_id='".$this->member['id']."'\r\n \t\t            ORDER BY c.position, f.position" );
		if ( $DB->get_num_rows( ) )
		{
			$last_cat_id = -1;
			while ( $forum = $DB->fetch_row( ) )
			{
				if ( $last_cat_id != $forum['cat_id'] )
				{
					$last_cat_id = $forum['cat_id'];
					$this->output .= $this->html->subs_forum_row( $forum['cat_id'], $forum['cat_name'] );
				}
				$forum['last_post'] = $std->get_date( $forum['last_post'], "LONG" );
				$forum['last_topic'] = $ibforums->lang['f_none'];
				$forum['last_title'] = str_replace( "&#33;", "!", $forum['last_title'] );
				$forum['last_title'] = str_replace( "&quot;", "\"", $forum['last_title'] );
				if ( 30 < strlen( $forum['last_title'] ) )
				{
					$forum['last_title'] = substr( $forum['last_title'], 0, 27 )."...";
					$forum['last_title'] = preg_replace( "/&(#(\\d+;?)?)?\\.\\.\\.\$/", "...", $forum['last_title'] );
				}
				if ( $forum['password'] != "" )
				{
					$forum['last_topic'] = $ibforums->lang['f_none'];
				}
				else
				{
					$forum['last_topic'] = "<a href='{$ibforums->base_url}&act=ST&f={$forum['id']}&t={$forum['last_id']}&view=getlastpost'>{$forum['last_title']}</a>";
				}
				if ( isset( $forum['last_poster_name'] ) )
				{
					$forum['last_poster'] = $forum['last_poster_id'] ? "<a href='{$ibforums->base_url}&act=Profile&CODE=03&MID={$forum['last_poster_id']}'>{$forum['last_poster_name']}</a>" : $forum['last_poster_name'];
				}
				else
				{
					$forum['last_poster'] = $ibforums->lang['f_none'];
				}
				$forum['folder_icon'] = $std->forum_new_posts( $forum );
				$this->output .= $this->html->forum_subs_row( $forum );
			}
		}
		else
		{
			$this->output .= $this->html->forum_subs_none( );
		}
		$this->output .= $this->html->forum_subs_end( );
		$this->page_title = $ibforums->lang['t_welcome'];
		$this->nav = array(
			"<a href='".$this->base_url."&act=UserCP&CODE=00'>".$ibforums->lang['t_title']."</a>"
		);
	}

	function pass_change( )
	{
		global $ibforums;
		global $DB;
		global $std;
		$this->output .= $this->html->pass_change( );
		$this->page_title = $ibforums->lang['t_welcome'];
		$this->nav = array(
			"<a href='".$this->base_url."&act=UserCP&CODE=00'>".$ibforums->lang['t_title']."</a>"
		);
	}

	function do_pass_change( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $HTTP_POST_VARS;
		global $print;
		if ( $HTTP_POST_VARS['current_pass'] == "" || empty( $HTTP_POST_VARS['current_pass'] ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "complete_form" ) );
		}
		$cur_pass = trim( $ibforums->input['current_pass'] );
		$new_pass = trim( $ibforums->input['new_pass_1'] );
		$chk_pass = trim( $ibforums->input['new_pass_2'] );
		if ( empty( $new_pass ) || empty( $chk_pass ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "complete_form" ) );
		}
		if ( $new_pass != $chk_pass )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "pass_no_match" ) );
		}
		if ( md5( $cur_pass ) != $this->member['password'] )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "wrong_pass" ) );
		}
		$md5_pass = md5( $new_pass );
		$DB->query( "UPDATE ibf_members SET password='{$md5_pass}' WHERE id='".$this->member['id']."'" );
		$std->my_setcookie( "pass_hash", $md5_pass, 1 );
		$print->redirect_screen( $ibforums->lang['pass_redirect'], "act=UserCP&CODE=00" );
	}

	function email_change( $msg = "" )
	{
		global $ibforums;
		global $DB;
		global $std;
		$txt = $ibforums->lang['ce_current'].$this->member['email'];
		if ( $ibforums->vars['reg_auth_type'] )
		{
			$txt .= $ibforums->lang['ce_auth'];
		}
		$r_date = time( ) - 21600;
		$DB->query( "DELETE FROM ibf_reg_antispam WHERE ctime < '{$r_date}'" );
		$regid = md5( uniqid( microtime( ) ) );
		mt_srand( ( double )microtime( ) * 1000000 );
		$reg_code = mt_rand( 100000, 999999 );
		$str = $DB->compile_db_insert_string( array(
			"regid" => $regid,
			"regcode" => $reg_code,
			"ip_address" => $ibforums->input['IP_ADDRESS'],
			"ctime" => time( )
		) );
		$DB->query( "INSERT INTO ibf_reg_antispam ({$str['FIELD_NAMES']}) VALUES ({$str['FIELD_VALUES']})" );
		$this->output .= $this->html->email_change( $txt, $regid, $ibforums->lang[$msg] );
		$this->page_title = $ibforums->lang['t_welcome'];
		$this->nav = array(
			"<a href='".$this->base_url."&act=UserCP&CODE=00'>".$ibforums->lang['t_title']."</a>"
		);
	}

	function do_email_change( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $HTTP_POST_VARS;
		global $print;
		if ( $HTTP_POST_VARS['in_email_1'] == "" )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "complete_form" ) );
		}
		if ( $HTTP_POST_VARS['in_email_2'] == "" )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_guests" ) );
		}
		$email_one = strtolower( trim( $ibforums->input['in_email_1'] ) );
		$email_two = strtolower( trim( $ibforums->input['in_email_2'] ) );
		if ( $email_one != $email_two )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "email_addy_mismatch" ) );
		}
		$email_one = $std->clean_email( $email_one );
		if ( $email_one == "" )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "invalid_email" ) );
		}
		if ( !$ibforums->vars['allow_dup_email'] )
		{
			$DB->query( "SELECT id FROM ibf_members WHERE email='".$email_one."'" );
			$email_check = $DB->fetch_row( );
			if ( $email_check['id'] )
			{
				$std->error( array( 1, "email_exists" ) );
			}
		}
		if ( $ibforums->input['regid'] == "" )
		{
			$this->email_change( "err_security_code" );
			return "";
		}
		$DB->query( "SELECT * FROM ibf_reg_antispam WHERE regid='".trim( addslashes( $ibforums->input['regid'] ) )."'" );
		if ( !( $row = $DB->fetch_row( ) ) )
		{
			$this->email_change( "err_security_code" );
			return "";
		}
		if ( trim( intval( $ibforums->input['reg_code'] ) ) != $row['regcode'] )
		{
			$this->email_change( "err_security_code" );
			return "";
		}
		if ( $ibforums->vars['reg_auth_type'] )
		{
			$validate_key = $std->make_password( );
			$DB->query( "UPDATE ibf_members SET validate_key='{$validate_key}', prev_group='".$this->member['mgroup']."', mgroup='".$ibforums->vars['auth_group']."', email='{$email_one}' WHERE id='".$this->member['id']."'" );
			if ( $ibforums->session_id )
			{
				$DB->query( "UPDATE ibf_sessions SET member_name='', member_id='0', member_group='".$ibforums->vars['guest_group']."' WHERE member_id='".$this->member['id']."' and id='".$ibforums->session_id."'" );
			}
			$std->my_setcookie( "pass_hash", "-1", 0 );
			$std->my_setcookie( "member_id", "-1", 0 );
			$std->my_setcookie( "session_id", "-1", 0 );
			$this->email->get_template( "newemail" );
			$this->email->build_message( array(
				"NAME" => $this->member['name'],
				"MAN_LINK" => $this->base_url_nosess."?act=Reg&CODE=07",
				"ID" => $this->member['id'],
				"CODE" => $validate_key
			) );
			$this->email->subject = $ibforums->lang['lp_subject']." ".$ibforums->vars['board_name'];
			$this->email->to = $email_one;
			$this->email->send_mail( );
			$print->redirect_screen( $ibforums->lang['ce_redirect'], "act=Reg&CODE=07" );
		}
		else
		{
			$DB->query( "UPDATE ibf_members SET email='{$email_one}' WHERE id='".$this->member['id']."'" );
			$print->redirect_screen( $ibforums->lang['email_changed_now'], "act=UserCP&CODE=00" );
		}
	}

	function tracker( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		$this->output .= $this->html->subs_header( );
		$auto_explain = $ibforums->lang['no_auto_prune'];
		if ( 0 < $ibforums->vars['subs_autoprune'] )
		{
			if ( time( ) % 2 )
			{
				$time_limit = time( ) - $ibforums->vars['subs_autoprune'] * 86400;
				$DB->query( "SELECT tr.trid FROM ibf_tracker tr, ibf_topics t WHERE t.tid=tr.topic_id AND t.last_post < '{$time_limit}'" );
				$trids = array( );
				while ( $r = $DB->fetch_row( ) )
				{
					$trids[] = $r['trid'];
				}
				if ( 0 < count( $trids ) )
				{
					$DB->query( "DELETE FROM ibf_tracker WHERE trid IN (".implode( ",", $trids ).")" );
				}
			}
			$auto_explain = sprintf( $ibforums->lang['auto_prune'], $ibforums->vars['subs_autoprune'] );
		}
		$date_cut = intval( $ibforums->input['datecut'] ) != "" ? intval( $ibforums->input['datecut'] ) : 30;
		$date_query = $date_cut != 1000 ? ( " AND t.last_post > '".( time( ) - $date_cut * 86400 ) )."' " : "";
		$DB->query( "SELECT s.trid, s.member_id, s.topic_id, s.last_sent, s.start_date as track_started, t.*, f.id as forum_id, f.name as forum_name, f.read_perms FROM ibf_tracker s, ibf_topics t, ibf_forums f WHERE s.member_id='".$this->member['id']."' AND t.tid=s.topic_id AND f.id=t.forum_id {$date_query}"."ORDER BY f.id, t.last_post DESC" );
		if ( $DB->get_num_rows( ) )
		{
			$last_forum_id = -1;
			while ( $topic = $DB->fetch_row( ) )
			{
				if ( $last_forum_id != $topic['forum_id'] )
				{
					$last_forum_id = $topic['forum_id'];
					$this->output .= $this->html->subs_forum_row( $topic['forum_id'], $topic['forum_name'] );
				}
				$topic['last_poster'] = $topic['last_poster_id'] != 0 ? "<b><a href='{$this->base_url}&act=Profile&CODE=03&MID={$topic['last_poster_id']}'>{$topic['last_poster_name']}</a></b>" : "-".$topic['last_poster_name']."-";
				$topic['starter'] = $topic['starter_id'] != 0 ? "<a href='{$this->base_url}&act=Profile&CODE=03&MID={$topic['starter_id']}'>{$topic['starter_name']}</a>" : "-".$topic['starter_name']."-";
				if ( $topic['poll_state'] )
				{
					$topic['prefix'] = $ibforums->vars['pre_polls']." ";
				}
				$topic['folder_icon'] = $std->folder_icon( $topic );
				$topic['topic_icon'] = $topic['icon_id'] ? "<img src=\"".$ibforums->vars[html_url]."/icon".$topic['icon_id'].".gif\" border=\"0\" alt=\"\">" : "&nbsp;";
				if ( $topic['pinned'] )
				{
					$topic['topic_icon'] = "<{B_PIN}>";
				}
				$topic['start_date'] = $std->get_date( $topic['track_started'], "LONG" );
				if ( $topic['description'] )
				{
					$topic['description'] = $topic['description']."<br>";
				}
				$pages = 1;
				if ( $topic['posts'] )
				{
					if ( ( $topic['posts'] + 1 ) % $ibforums->vars['display_max_posts'] == 0 )
					{
						$pages = ( $topic['posts'] + 1 ) / $ibforums->vars['display_max_posts'];
					}
					else
					{
						$number = ( $topic['posts'] + 1 ) / $ibforums->vars['display_max_posts'];
						$pages = ceil( $number );
					}
				}
				if ( 1 < $pages )
				{
					$topic['PAGES'] = "<span class='small'>({$ibforums->lang['topic_sp_pages']} ";
					$i = 0;
					for ( ;	$i < $pages;	++$i	)
					{
						$real_no = $i * $ibforums->vars['display_max_posts'];
						$page_no = $i + 1;
						if ( $page_no == 4 )
						{
							$topic['PAGES'] .= "<a href='{$this->base_url}&act=ST&f={$this->forum['id']}&t={$topic['tid']}&st=".( $pages - 1 ) * $ibforums->vars['display_max_posts']."'>...{$pages} </a>";
							break;
						}
						else
						{
							$topic['PAGES'] .= "<a href='{$this->base_url}&act=ST&f={$this->forum['id']}&t={$topic['tid']}&st={$real_no}'>{$page_no} </a>";
						}

⌨️ 快捷键说明

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