📄 city_search.php
字号:
<?php
require_once("configs/Configs.php");//加载配置文件
require_once("functions/login_flag.php");//是否已经登录
require_once("functions/func_common.php");//加载函数文件
if($_POST['action']=="search"){
include_once("functions/class_mysql.php");//加载数据库类文件
$query=$db->query("select p_score from player_info where `u_id`='".$UserId."'");
$score_row=$db->fetch_array($query);
$keyword=trim($_POST['searchstring']);
if($_POST['searchstring']<>""){
if($_POST['searchtype']=="citynumber") $q=" where c.`u_id`=p.`u_id` and `p`.`u_id`='".$keyword."'";
elseif($_POST['searchtype']=="cityname") $q=" where c.`u_id`=p.`u_id` and `c`.`c_name` like '%".$keyword."%' limit 100";
elseif($_POST['searchtype']=="playername") $q=" where c.`u_id`=p.`u_id` and `p`.`p_nickname` like '%".$keyword."%' limit 100";
elseif($_POST['searchtype']=="belowme") $q=" where c.`u_id`=p.`u_id` and `p`.`p_score` < '".$score_row['p_score']."' limit 0,30";
}else{
if($_POST['searchtype']=="citynumber") $q=" where c.`u_id`=p.`u_id` and `p`.`u_id`='".$keyword."' limit 1";
elseif($_POST['searchtype']=="belowme") $q=" where c.`u_id`=p.`u_id` and `p`.`p_score` < '".$score_row['p_score']."' limit 0,100";
else{
$q=" order by p_score desc limit 0,100";
}
}
$query=$db->query("select * from player_info as p,city as c $q");
while($row=$db->fetch_array($query)) $result_list[]=$row;
$db->close();
$result_rn=$db->num_rows($query);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>城池查询</title>
<link href="css/id.css" rel="stylesheet" type="text/css">
<link href="css/css.css" rel="stylesheet" type="text/css">
<link type="text/css" href="css/build.css" rel="stylesheet">
<style>
body{
margin-top:0px;
}
</style>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
var curPID;
function showMenu(pid, pname)
{
var menu = document.all.pMenu;
if (menu.style.display == '') menuClose();
curPID = pid;
player = pname + ' (' + pid + ')';
document.all.menuName.innerText = '对 ' + player + ' 的行动';
document.all.menuMessage.innerText = '发消息';
document.all.menuAid.innerText = '发送援助';
document.all.menuAttackArmy.innerText = '普通打击';
document.all.menuAttackCatapults.innerText = '毁灭打击';
document.all.menuAttackThieves1.innerText = '窃取信息';
document.all.menuAttackThieves2.innerText = '窃取货物';
document.all.menuAttackThieves3.innerText = '水里下毒';
document.all.menuAttackBattles.innerText = '最近战役';
//document.all.menuHistory.innerText = '查看图表';
document.all.menuClose.innerText = '关闭菜单';
menu.style.left=document.body.scrollLeft+event.clientX-event.offsetX-5;
menu.style.top=document.body.scrollTop+event.clientY-event.offsetY+15;
menu.style.display = '';
}
function menuClose()
{
curPID = 0;
document.all.pMenu.style.display = 'none';
}
function menuOut(td) {
td.style.backgroundColor = '';
td.style.color = '';
}
function menuOver(td) {
td.style.backgroundColor = 'blue';
td.style.color = 'white';
}
function menuEflag(v)
{
var u = v;
window.open(u, '_self');
}
</SCRIPT>
<div style="display:none;position:absolute;border:2px outset" id="pMenu">
<table border=0 cellpadding=1 cellspacing=1 bgcolor="Silver" align="left">
<tr><td style="font-family:verdana;font-size:11px;font-weight:bold;color:black" id="menuName"></td></tr>
<tr><td class="menuItem" style="text-align:left; cursor:hand;" id="menuMessage" onmouseover="menuOver(this)" onmouseout="menuOut(this)" onclick="menuEflag('message_put.php?e_username=')"></td></tr>
<tr><td class="menuItem" style="text-align:left; cursor:hand;" id="menuAid" onmouseover="menuOver(this)" onmouseout="menuOut(this)" onclick="menuEflag('aid')"></td></tr>
<tr><td class="menuItem" style="text-align:left; cursor:hand;" id="menuAttackArmy" onmouseover="menuOver(this)" onmouseout="menuOut(this)" onclick="menuEflag('attack_army&attack_type=0')"></td></tr>
<tr><td class="menuItem" style="text-align:left; cursor:hand;" id="menuAttackCatapults" onmouseover="menuOver(this)" onmouseout="menuOut(this)" onclick="menuEflag('message_put.php?e_username=')"></td></tr>
<tr><td class="menuItem" style="text-align:left; cursor:hand;" id="menuAttackThieves1" onmouseover="menuOver(this)" onmouseout="menuOut(this)" onclick="menuEflag('')"></td></tr>
<tr><td class="menuItem" style="text-align:left; cursor:hand;" id="menuAttackThieves2" onmouseover="menuOver(this)" onmouseout="menuOut(this)" onclick="menuEflag('')"></td></tr>
<tr><td class="menuItem" style="text-align:left; cursor:hand;" id="menuAttackThieves3" onmouseover="menuOver(this)" onmouseout="menuOut(this)" onclick="menuEflag('')"></td></tr>
<tr><td class="menuItem" style="text-align:left; cursor:hand;" id="menuAttackBattles" onmouseover="menuOver(this)" onmouseout="menuOut(this)" onclick="menuEflag('')"></td></tr>
<tr><td><hr noshade size="1"></td></tr>
<tr><td class="menuItem" id="menuClose" onmouseover="menuOver(this)" onmouseout="menuOut(this)" onclick="menuClose()"></td></tr>
</table>
</div>
<!--导航-->
<?php require_once("map_daohang.htm");?>
<div id="mb_01">
<div class="page_build_title">玩家查询</div>
</div>
<div id="mb_04">
<!--替换区域开始-->
<table border=0 cellspacing=0 cellpadding=0 width="300" style="margin-top:20px;">
<form action="" method="post" name="search_city">
<input type="hidden" name="action" value="search">
<tr><td align="center">
<table border=1 cellspacing=0 cellpadding=5 width="500" bordercolor="threeddarkshadow" style="border-collapse:collapse;border:1px solid threeddarkshadow">
<tr>
<td align="center">查询选项</td>
<td align="left"><input type="Radio" style="cursor:hand" name="searchtype" id="searchtype" <?php if($_POST['searchtype']=="citynumber" or $_POST['action']=="") echo "checked";?> value="citynumber"><label for="search1" style="cursor:hand">玩家编号</label>
<input type="Radio" style="cursor:hand" name="searchtype" id="searchtype" <?php if($_POST['searchtype']=="playername") echo "checked";?> value="playername"><label for="search3" style="cursor:hand">玩家昵称 </label>
<input type="Radio" style="cursor:hand" name="searchtype" id="searchtype" <?php if($_POST['searchtype']=="belowme") echo "checked";?> value="belowme"><label for="search5" style="cursor:hand">排名在我之后的30名玩家</label>
</td>
</tr>
<tr>
<td align="center">查询内容</td>
<td align="left">
<input type="Text" name="searchstring" value="<?php echo $_POST['searchstring'];?>" size=20 style="font-size:10px;">
</td>
</tr>
</table>
</td></tr>
<tr><td style="border:1px solid threeddarkshadow;"><center><input type="Submit" value="查询" style="font-size:10px;width:80;cursor:hand;"></center></td></tr>
</form>
</table>
<?php if($result_list<>"" and $_POST['action']=="search") { ?>
<table border=1 cellspacing=1 cellpadding=1 width="90%" bordercolor="threeddarkshadow" style="border-collapse:collapse;border:1px solid threeddarkshadow;margin-top:20px;">
<tr>
<td colspan="9" align="center">查询结果(<?php echo $result_rn;?>):</td>
</tr>
<tr>
<td align="center" > </td>
<td align="center" >城池名称</td>
<td align="center" >坐标</td>
<td align="center" >国家</td>
<td align="center" >联盟</td>
<td align="center" >城主名字</td>
<td align="center" >爵位</td>
<td align="center" >声望值</td>
<td align="center" >排名</td>
</tr>
<?php foreach ($result_list as $i=>$m) { ?>
<tr><td><?php echo $i;?></td>
<td align="left"><span onclick="showMenu('<?php echo $m['u_id'];?>', '<?php echo $m['c_name'];?>')" style="cursor:hand"><?php echo $m['c_name'];?> (#<?php echo $m['u_id'];?>)</a></td>
<td align="center"><?php echo $m['c_area'];?>:<?php echo $m['c_area_x'];?>:<?php echo $m['c_area_y'];?></td>
<td align="center" class="SMALL"><?php echo $country_num[$m['p_country']];?></td>
<td align="center"><?php if($m['army_name']<>"") echo $m['army_name'];else echo "无";?></td>
<td align="center"><?php echo $m['p_nickname'];?></td>
<td align="center"><?php echo officer_name($m['p_score'],$m['p_country']);?></td>
<td align="center"><?php echo $m['p_score'];?></td>
<td align="center"><?php echo $i;?></td>
</tr>
<?php } ?>
</table>
<?php }elseif($_POST['action']=="search" and $result_list==""){ ?>
<div id="building_description" class="task_title">查询没有结果</div>
<?php } ?>
<!--替换区域结束-->
</div>
</div>
<div id="mb_03"></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -