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

📄 world_map.php

📁 Download you own three BR
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php
session_start();
set_time_limit(180);
require_once("configs/Configs.php");//加载配置文件
require_once("functions/func_common.php");//加载函数文件
require_once("functions/class_mysql.php");//加载数据库类文件
//查询并获取玩家的坐标值;
$query=$db->query("select c_area,c_area_x from city 
where c_id='".$_COOKIE['CityId']."' and u_id='".$_COOKIE['UserId']."';");
$area_list=$db->fetch_array($query);
//判断地址有没有X和Y;x2和y2是自己坐标
if ($_POST['action']=='xyp') {
	if (!ereg("^[0-9]*$",$_POST['xp']) or !ereg("^[0-9]*$",$_POST['yp'])) echomsg("坐标输入不归范!","?");
	if ($_POST['xp']<1 || $_POST['yp'] <1) echomsg("请输入X,Y坐标!","?");
	 if(isset($_POST['xp'])){
	
	if ($_POST['xp']>$area_max) {
		$_POST['xp']=$area_max;
	}
	$x=$_POST['xp'];}else{$x=1;}
	if(isset($_POST['yp'])){
	   if ($_POST['yp']>$area_x_max) {
	   	$_POST['yp']=$area_x_max;
	   }
    $y=$_POST['yp'];}else{$y=1;}
	$x2=$area_list['c_area'];
	$y2=$area_list['c_area_x'];
	}else {
	if ($_GET['x']>0) {	
		if ($_GET['x']>$area_max) $_GET['x']=$area_max;
		$x=$_GET['x'];
		$x2=$area_list['c_area'];
	}else {
		$x=$area_list['c_area'];
		$x2=$area_list['c_area'];
	}
	if ($_GET['y']>0) {
		if ($_GET['y']>$area_max) $_GET['y']=$area_x_max;
		$y=$_GET['y'];
		$y2=$area_list['c_area_x'];
	}else {
		$y=$area_list['c_area_x'];
		$y2=$area_list['c_area_x'];
	}
}
/////////“显示坐标值”写入数组////////////////
//echo $x.','.$y;
$j=3;
$z=1;
for ($i=1;$i<=7;$i++)
{
	if ($i<4) {		
			if (($x-$j)<=0) {
				$area_x[$i]=$area_max-($j-$x);
			}else {
				$area_x[$i]=$x-$j;
			}
			//Y轴
			if (($y-$j)<=0) {
				$area_y[$i]=$area_x_max-($j-$y);
			}else {
				$area_y[$i]=$y-$j;
			}
		$j--;
	}elseif ($i>4){				
			if (($x+$z)>$area_max) {
				$area_x[$i]=($x+$z)-$area_max;
			}else {
				$area_x[$i]=$x+$z;
			}
			//Y轴
			if (($y+$z)>$area_max) {
				$area_y[$i]=($y+$z)-$area_x_max;
			}else {
				$area_y[$i]=$y+$z;
			}
		$z++;
	}else {
		$area_x[$i]=$x;
		$area_y[$i]=$y;
	}
}
//$area_x=array(1=>($x-3),2=>($x-2),3=>($x-1),4=>$x,5=>($x+1),6=>($x+2),7=>($x+3));
//$area_y=array(1=>($y-3),2=>($y-2),3=>($y-1),4=>$y,5=>($y+1),6=>($y+2),7=>($y+3));

/////////////////
//查询玩家等级;
/////////////////
$query_me=$db->query("select p_grade from player_info where u_id='".$_COOKIE['UserId']."';");
$list_me=$db->fetch_array($query_me);
$me_grade=$list_me['p_grade'];
  
			    //写入地图信息;
			   $query_son1=$db->query("select u_id from city where  c_area='".$x2."' and c_area_x='".$y2."';");
               $player_son1=$db->fetch_array($query_son1);
               $u_id=$player_son1['u_id'];
			    $z=1;
			    for ($i=1;$i<=7;$i++)
			    {
			    	for ($j=1;$j<=7;$j++)
			    	{
			    		//查询该坐标上是否有玩家,没有数组数为0,有为1,自己为2,$map_con为记录此值的数组;
			    		$query=$db->query("select * from city where c_area='".$area_x[$i].
						"' and c_area_x='".$area_y[$j]."';");						
			    		$mxs_num=$db->num_rows($query);
			    		//查询玩家u_id和城市名称,$city_names为记录此值的数组;
			    		$mxs_list=$db->fetch_array($query);			    		
			    		if (!$mxs_num>0) {			    			
			    			$map_con[$z]=0;
			    			$city_names[$z]='';
			    			$player_names[$z]='';
			    			$player_countrys[$z]='';
			    			$player_union_names[$z]='';
			    		}else {			    			
			    			if ($area_x[$i]==$x2&&$area_y[$j]==$y2) {
			    				$map_con[$z]=2;
			    				$city_names[$z]=$mxs_list['c_name'];
			    				//根据u_id查找玩家信息,$player_names记录玩家昵称,$player_countrys记录玩家国家;$player_union_names记录联盟名称;
				    			$query2=$db->query("select * from player_info where u_id='".$mxs_list['u_id']."';");
				    			$player_list=$db->fetch_array($query2);					    			
				    			$queryuc=$db->query("select a.u_ico from unions a left join player_info b on(b.union_id=a.id) where a.id='".$player_list['union_id']."' ");				    							    			
				    			$player_listuc=$db->fetch_array($queryuc);
				    			
				    			$un_ico[$z]=$player_listuc['u_ico'];			    			
				    			$player_names[$z]=$player_list['p_nickname'];
				    			if ($player_list['p_country']=='1') {
				    				$player_countrys[$z]='魏';
				    				$player_countrys2[$z]=$player_list['p_country'];
				    			}elseif ($player_list['p_country']=='2') {
				    				$player_countrys[$z]='蜀';
				    				$player_countrys2[$z]=$player_list['p_country'];
				    			}elseif ($player_list['p_country']=='3') {
				    				$player_countrys[$z]='吴';
				    				$player_countrys2[$z]=$player_list['p_country'];
				    			}
				    			if (!$player_list['union_name']>0) {
				    				$player_union_names[$z]='';
				    			}else {
				    			    $player_union_names[$z]=$player_list['union_name'];
				    			}
			    			}else {
			    				$map_con[$z]=1;
			    				$city_names[$z]=$mxs_list['c_name'];
			    				//根据u_id查找玩家信息,$player_names记录玩家昵称,$player_countrys记录玩家国家;$player_union_names记录联盟名称;
				    			$query3=$db->query("select * from player_info where u_id='".$mxs_list['u_id']."';");
				    			$player_list=$db->fetch_array($query3);
				    			
				    			$queryuc1=$db->query("select a.u_ico from unions a left join player_info b on(b.union_id=a.id) where a.id='".$player_list['union_id']."' ");				    							    			
				    			$player_listuc1=$db->fetch_array($queryuc1);
				    			
				    			$un_ico[$z]=$player_listuc1['u_ico'];
				    			//判断是否是在免战期
				    			$query_good=$db->query("select id from add_goods_info where u_id='".$mxs_list['u_id']."' and type='2';");
				    			$notie_num=$db->num_rows($query_good);
				    			if ($notie_num>0) {
				    				$player_state[$z]="mian.jpg"; 
									$player_names[$z]=$player_list['p_nickname'];
				    			}elseif (time()<($player_list['protect_date']*24*60*60+$player_list['create_date'])) {//保护期;
				    				$player_state[$z]="m_10.jpg"; //玩家攻击力量对比
									$player_names[$z]=$player_list['p_nickname'];
				    			}elseif ($player_list['p_grade']-$me_grade>=0) {
				    				if ($player_list['p_grade']-$me_grade>8) {//强大
									    $player_state[$z]="m_09.jpg";//玩家攻击力量对比
				    					$player_names[$z]=$player_list['p_nickname'];
				    				}elseif ($player_list['p_grade']-$me_grade<=8){//平级;                                 
									    $canfire[$z]="true"; //可以攻打
				    					$player_state[$z]="m_05.jpg";//玩家攻击力量对比
										$player_names[$z]=$player_list['p_nickname'];
				    				}else {//弱小
									    $player_state[$z]="m_08.jpg";//玩家攻击力量对比
				    					$player_names[$z]=$player_list['p_nickname'];
				    				}			    				
				    			}elseif ($player_list['p_grade']-$me_grade<0) {
				    				if ($me_grade-$player_list['p_grade']>6) {//弱小
									     $player_state[$z]="m_08.jpg";//玩家攻击力量对比
				    					$player_names[$z]=$player_list['p_nickname'];
				    				}elseif ($me_grade-$player_list['p_grade']<=8){//平级;                                 
									    $canfire[$z]="true"; //可以攻打
				    					$player_state[$z]="m_05.jpg";//玩家攻击力量对比
										$player_names[$z]=$player_list['p_nickname'];
				    				}else {//强大
				    					$player_state[$z]="m_09.jpg";//玩家攻击力量对比
										$player_names[$z]=$player_list['p_nickname'];
				    				}
				    			}				    			
				    			if ($player_list['p_country']=='1') {
				    				$player_countrys[$z]='魏';
				    				$player_countrys2[$z]=$player_list['p_country'];
				    			}elseif ($player_list['p_country']=='2') {
				    				$player_countrys[$z]='蜀';
				    				$player_countrys2[$z]=$player_list['p_country'];
				    			}elseif ($player_list['p_country']=='3') {
				    				$player_countrys[$z]='吴';
				    				$player_countrys2[$z]=$player_list['p_country'];
				    			}
				    			if (!$player_list['union_name']>0) {
				    				$player_union_names[$z]='';
				    			}else {
				    			    $player_union_names[$z]=$player_list['union_name'];
				    			}
			    			}
			    		}
			    		$z++;
			    	}
			    }
			    ?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<link href="css/map.css" rel="stylesheet" type="text/css">
<link href="css/css.css" rel="stylesheet" type="text/css">
<SCRIPT src="css/unx.js" type=text/javascript></SCRIPT>
<script language="javascript">
function xyzb(x,y){
document.getElementById("x").firstChild.nodeValue = x;
document.getElementById("y").firstChild.nodeValue = y;
}
</script>

<style type="text/css">
<!--
body {
	background-image: url(map/sd.jpg);
}
.style2 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 18px;
	font-weight: bold;
}
.style3 {font-family: Verdana, Arial, Helvetica, sans-serif}
-->
</style>
<style type="text/css">
.aa {
	border: 2px solid #FF0000;
}
</style>

</head>
<body>
<?php
if (isset($_POST['action'])) {
	$x_num=$_POST['xp'];
    $y_num=$_POST['yp'];
  if ($x_num>$area_max) {
  	$x_num=$area_max;
  	
  }
  if ($y_num>$area_x_max) {
  	$y_num=$area_x_max;
  }
    
}

?>
 <div id="tc_02">
    <div id="mb_0">
    <div id="mm_01"><a href="world_map.php" target="main">势力图</a></div>
	</div>	
	<div id="mb_2">
	  <div id="mm_01"><a href="score_rank.php" target="main">排行榜</a></div>
	</div>
</div>
<table width="719" height="50" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="26">&nbsp;</td>
    <td width="99"><span class="le_01 style3"> 三国势力图 </span></td>
    <td width="178" ><span class="style2">(<span id="x">
      <?php if(isset($x)){ echo $x;}else{echo '1';}?> </span>
      | 
     <span id="y"> <?php if(isset($y)) {echo $y ;}else{echo '1';}?></span>
    )</span></td>
    <form action="" method="post" id="form13" >
	  <input type="hidden" name="action" value="xyp">
	<td width="15"><strong class="le_01 style3">X</strong></td>
    <td width="49"><input name="xp" id="xp" type="text" size="5" maxlength="4" onblur=IsNum(this)></td>
    <td width="18"><strong class="le_01 style3">Y</strong></td>
    <td width="51"><input name="yp" id="yp" type="text" size="5" onblur=IsNum(this) maxlength="4"></td>
    <td width="121"><input src="map/wx_01.gif" type="image" width="46" height="18" onclick="check()" ></td>
	</form>	
   <td width="44">
	<a href="?x=<?php  
	   if($x-7<=0){
	   echo $area_max-(7-$x);
	   }else
	   echo $x-7;?>&y=<?php echo $y; ?>" 
	    title="后退" >
	<img src="map/p_06.gif" width="31" height="25" border="0"></a>
	<a>	</td>
    
	<td width="40">
	<a href="?x=<?php
	  if(($x+7)>=$area_max){

⌨️ 快捷键说明

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