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

📄 change_character.php

📁 三國好好 子
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?
include("../config.php");
include("aup.php");

	function GetAppearanceList($folder, $current)
	{
		$sList = "";
		$handle = opendir($folder);
		$file = readdir($handle);
		while($file)
		{
			if(is_file($folder.$file)) {
				$sSelected = ($folder.$file == "../$current") ? " selected=\"selected\"" : "";
				$sList .= "<option value=\"".$folder.$file."\"$sSelected>".$file."</option>\n";
			}
			$file = readdir($handle);
		}
		closedir($handle);
		return $sList;
	}

?>
<html>
<head>
<title>WoP Admin Panel - Change Character</title>
<link href="..\styles\phaos.css" rel="stylesheet" type="text/css">

<script type="text/javascript">

	function LoadAppearance(sPreviewID)
	{
		var oAppearance = window.document.getElementById("image_path");
		var sAppearanceImg = oAppearance.options[oAppearance.selectedIndex].value;

		window.document.getElementById(sPreviewID).src = sAppearanceImg;
	}

</script>
</head>
<body>
<?
//if (isset($_POST['$changeme'])) { (***Commented out as this IF statement doesn't seem to work -ARADAN***)
if($changeme=="yes") {
	mysql_query("UPDATE phaos_characters SET location='$location', username='$username', name='$name', age='$age', sex='$sex', strength='$strength', dexterity='$dexterity', wisdom='$wisdom', constitution='$constitution', weapon='$weapon', hit_points='$hit_points', race='$race', class='$class', xp='$xp', level='$level', gold='$gold', armor='$armor', image_path='".str_replace("../", "", $image_path)."', stat_points='$stat_points', boots='$boots', gloves='$gloves', helm='$helm', shield='$shield', regen_time='$regen_time', dungeon_location='$dungeon_location', stamina='$stamina', stamina_time='$stamina_time', fight='$fight', defence='$defence', weaponless='$weaponless', lockpick='$lockpick', traps='$traps', rep_time='$rep_time', rep_points='$rep_points', rep_helpfull='$rep_helpfull', rep_generious='$rep_generious', rep_combat='$rep_combat' WHERE id='$id'");
	echo "<table width=\"100%\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
		<tr>
	  	<td align=center valign=middle height=\"100%\" width=\"100%\">
			<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\">
		  	<tr>
		  	<td colspan=\"2\" align=center>
		  		<b>Character '$name' for user '$username' has been changed!</b>
		  	</td>
		  	</tr>
		  	<tr>
		  	<td colspan=\"2\" align=center>
		  		<form><input type='button' onClick=\"parent.location='admin_users_Edit_Users_Character.php'\" value='OK'></form>
		  	</td>
		  	</tr>
		  	</table>
		</td>
		</tr>
		</table>";
} else {
	$result = mysql_query("SELECT * FROM phaos_characters WHERE id=$character");
	while ($row = mysql_fetch_array($result)) {
		$id = $row["id"];
		$username = $row["username"];
		$image_path = $row["image_path"];
		$name = $row["name"];
		$age = $row["age"];
		$sex = $row["sex"];
		$race = $row["race"];
		$class = $row["class"];
		
		$strength = $row["strength"];
		$dexterity = $row["dexterity"];
		$wisdom = $row["wisdom"];
		$constitution = $row["constitution"];
		
		$hit_points = $row["hit_points"];
		$stat_points = $row["stat_points"];
		$xp = $row["xp"];
		$level = $row["level"];
		$gold = $row["gold"];
		
		$rep_points = $row["rep_points"];
		$rep_helpfull = $row["rep_helpfull"];
		$rep_generious = $row["rep_generious"];
		$rep_combat = $row["rep_combat"];
		
		$weapon_id = $row["weapon"];
		$armor_id = $row["armor"];
		$boots_id = $row["boots"];
		$gloves_id = $row["gloves"];
		$helm_id = $row["helm"];
		$shield_id = $row["shield"];
		
		$regen_time = $row["regen_time"];
		$stamina = $row["stamina"];
		$stamina_time = $row["stamina_time"];
		$rep_time = $row["rep_time"];
		
		$fight = $row["fight"];
		$defence = $row["defence"];
		
		$weaponless = $row["weaponless"];
		$lockpick = $row["lockpick"];
		$traps = $row["traps"];
		
		$location_id = $row["location"];
		$dungeon_location_id = $row["dungeon_location"];
		
		
		if($sex == "") {
			$sex_sex = "Please select a sex type";
		} else {
			$result = mysql_query ("SELECT * FROM phaos_sex WHERE sex = '$sex'");
			if ($row = mysql_fetch_array($result)) {$sex_sex = $row["sex"];}
		}
		
		if($race == "") {
			$race_name = "Please select a race";
		} else {
			$result = mysql_query ("SELECT * FROM phaos_races WHERE name = '$race'");
			if ($row = mysql_fetch_array($result)) {$race_name = $row["name"];}
		}
		
		if($class == "") {
			$class_name = "Please select a class";
		} else {
			$result = mysql_query ("SELECT * FROM phaos_classes WHERE name = '$class'");
			if ($row = mysql_fetch_array($result)) {$class_name = $row["name"];}
		}
		
		if($weapon_id == "0") {
			$weapon_name = "None";
		} else {
			$result = mysql_query ("SELECT * FROM phaos_weapons WHERE id = '$weapon_id'");
			if ($row = mysql_fetch_array($result)) {$weapon_name = $row["name"];}
		}
		
		if($shield_id == "0") {
			$shield_name = "None";
		} else {
			$result = mysql_query ("SELECT * FROM phaos_shields WHERE id = '$shield_id'");
			if ($row = mysql_fetch_array($result)) {$shield_name = $row["name"];}
		}
		
		if($helm_id == "0") {
			$helm_name = "None";
		} else {
			$result = mysql_query ("SELECT * FROM phaos_helmets WHERE id = '$helm_id'");
			if ($row = mysql_fetch_array($result)) {$helm_name = $row["name"];}
		}
		
		if($gloves_id == "0") {
			$gloves_name = "None";
		} else {
			$result = mysql_query ("SELECT * FROM phaos_gloves WHERE id = '$gloves_id'");
			if ($row = mysql_fetch_array($result)) {$gloves_name = $row["name"];}
		}
		
		if($boots_id == "0") {
			$location_name = "None";
		} else {
			$result = mysql_query ("SELECT * FROM phaos_boots WHERE id = '$boots_id'");
			if ($row = mysql_fetch_array($result)) {$boots_name = $row["name"];}
		}
		
		if($location_id == "0") {
			$location_name = "Please select a location";
		} else {
			$result = mysql_query ("SELECT * FROM phaos_locations WHERE id = '$location_id'");
			if ($row = mysql_fetch_array($result)) {$location_name = $row["name"];}
		}
		
		if($dungeon_location_id == "0") {
			$dungeon_location_name = "None";
		} else {
			$result = mysql_query ("SELECT * FROM phaos_locations_dungeon WHERE id = '$dungeon_location_id'");
			if ($row = mysql_fetch_array($result)) {$dungeon_location_name = $row["name"];}
		}
		
	}
?>
<form action="change_character.php?changeme=yes" method="post">
<input type="hidden" name="id" value="<?=$id?>">
	<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
	<td align=center valign=middle height="100%" width="100%">
  	<table width="600" border="1" cellspacing="0" cellpadding="3">
   <tr style=background:#006600;>
   <td colspan="2">
		<div align="center"><b>Edit character for user <?=$username?></b></div>
	</td>
	</tr>
	<tr>
	<td colspan="2">
		<div align="center"><font color=red><b>NOTE: Please make sure you understand the values before you change them as altering the values incorrectly may cause problems with the users character.</b></font></div>
	</td>
	</tr>
	<tr>
	<td width="50%"><b><font color="#FFFFFF">User Name</font></b></td>
	<td width="50%"> <b><font color="#FFFFFF">
		<input type="text" name="username" value="<?=$username?>">
		</font></b>
	</td>
	</tr>
	<tr>
	<td width="50%"><b><font color="#FFFFFF">Character Name</font></b></td>
	<td width="50%"> <b><font color="#FFFFFF">
		<input type="text" name="name" value="<?=$name?>">
		</font></b>
	</td>
	</tr>
	<tr> 
	<td width="50%"><b><font color="#FFFFFF">Age</font></b></td>
	<td width="50%"> <b><font color="#FFFFFF">
		<input type="text" name="age" value="<?=$age?>">
		</font></b>
	</td>
	</tr>
	<tr> 
	<td width="50%"><b><font color="#FFFFFF">Sex</font></b></td>
	<td width="50%"> <b><font color="#FFFFFF">
		<select name="sex">
		<?
		$result = mysql_query ("SELECT * FROM phaos_sex ORDER BY id ASC");
		if ($row = mysql_fetch_array($result)) {
			do {
				$id_num = $row["id"];
				$sex_sex = $row["sex"];
				if ($sex == $sex_sex) {
					print ("<option value=\"$sex_sex\" selected >$sex_sex</option>");
				} else {
					print ("<option value=\"$sex_sex\">$sex_sex</option>");
				}
			} while ($row = mysql_fetch_array($result));
		}
		?>
		</select>
		</font></b>
	</td>
	</tr>
	<tr> 
	<td width="50%"><b><font color="#FFFFFF">Race</font></b></td>
	<td width="50%"><b><font color="#FFFFFF">
		<select name="race">
		<?
		$result = mysql_query ("SELECT * FROM phaos_races ORDER BY id ASC");
		if ($row = mysql_fetch_array($result)) {
			do {
				$id_num = $row["id"];
				$race_name = $row["name"];
				if ($race == $race_name) {
					print ("<option value=\"$race_name\" selected >$race_name</option>");
				} else {
					print ("<option value=\"$race_name\">$race_name</option>");
				}
			} while ($row = mysql_fetch_array($result));
		}
		?>
		</select>
		</font></b>
	</td>
   </tr>
	<tr> 
	<td width="50%"><b><font color="#FFFFFF">Class</font></b></td>
	<td width="50%"><b><font color="#FFFFFF">
		<select name="class">
	  	<?
		$result = mysql_query ("SELECT * FROM phaos_classes ORDER BY id ASC");
		if ($row = mysql_fetch_array($result)) {
			do {
				$id_num = $row["id"];
				$class_name = $row["name"];
				if ($class == $class_name) {
					print ("<option value=\"$class_name\" selected >$class_name</option>");
				} else {
					print ("<option value=\"$class_name\">$class_name</option>");
				}
			} while ($row = mysql_fetch_array($result));
		}
		?>
		</select>
		</font></b>
	</td>
	</tr>
	<tr> 
	<td width="50%"><b><font color="#FFFFFF">Image</font></b></td>
	<td width="50%">
		<select name="image_path" id="image_path" onChange="javascript: LoadAppearance('current_appearance');">
			<?= GetAppearanceList("../images/icons/characters/", $image_path); ?>
		</select>
		<img id="current_appearance" name="current_appearance" src="../<?= $image_path; ?>" />
		
	</td>
	</tr>
	<tr>
	<td colspan="2"><center><b>ATTRIBUTES</b></center></td>
	</tr>
	<tr> 
	<td width="50%"><b><font color="#FFFFFF">Strength</font></b></td>
	<td width="50%"> <b><font color="#FFFFFF">
		<input type="text" name="strength" value="<?=$strength?>">
		</font></b>
	</td>
	</tr>
	<tr> 
	<td width="50%"><b><font color="#FFFFFF">Dexterity</font></b></td>
	<td width="50%"> <b><font color="#FFFFFF">
		<input type="text" name="dexterity" value="<?=$dexterity?>">
		</font></b>
	</td>
	</tr>
	<tr> 
	<td width="50%"><b><font color="#FFFFFF">Wisdom</font></b></td>
	<td width="50%"> <b><font color="#FFFFFF">
		<input type="text" name="wisdom" value="<?=$wisdom?>">
		</font></b>
	</td>
	</tr>
	<tr> 
	<td width="50%"><b><font color="#FFFFFF">Constitution</font></b></td>
	<td width="50%"> <b><font color="#FFFFFF">
		<input type="text" name="constitution" value="<?=$constitution?>">
		</font></b>
	</td>
	</tr>
	<tr> 
	<td width="50%"><b><font color="#FFFFFF">Stat Points to distribute</font></b></td>
	<td width="50%"> <b><font color="#FFFFFF">

⌨️ 快捷键说明

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