📄 score_rank.php
字号:
<?php
require_once("configs/Configs.php");//加载配置文件
require_once("functions/login_flag.php");//是否已经登录
require_once("functions/func_common.php");//加载函数文件
require_once("functions/class_mysql.php");//加载数据库类文件
$query1 = $db->query("select * from `player_info`");
while($total_num = $db->fetch_array($query1)){
//更新等级和经验
for($i=1;$i>0;$i++){
$query_grade2=$db->query("select p_score,p_grade from player_info where `u_id`='".$total_num['u_id']."'");
$grade_result2=$db->fetch_array($query_grade2);
//下级所需经验
$next_score = 300 * pow(1.2,$grade_result2['p_grade']);
//当前经验值与下级所需经验比较
$remain_score = ($grade_result2['p_score'] >= $next_score) ? $grade_result2['p_score'] - $next_score : "-1";
if($remain_score >= 0){
//更新等级与经验值
$db->query("update player_info set `p_grade`='".($grade_result2['p_grade']+1)."',`p_score`='".$remain_score."' where `u_id`='".$total_num['u_id']."'");
}else break;
}
}
//1-30名
$query=$db->query("select * from player_info order by p_grade desc,p_score desc limit 0,20");
while($row=$db->fetch_array($query)) $rank_list5[]=$row;
/*
//我当前名次
$k=0;
if($rank_list5<>"") foreach ($rank_list5 as $i=>$m){
if($m['u_id']==$UserId) break;
else $k++;
}
//我的前30名和后30名
$query=$db->query("select * from player_info where `u_id`='".$_COOKIE['UserId']."'");
$wo_rank = $db->fetch_array($query);
//$start=($k-30 > 0) ? $k-30 : 0;$end=$k+30;or `p_score`>='".$wo_rank['p_score']."'
$query=$db->query("select * from player_info where `p_score`<='".$wo_rank['p_score']."' or `p_score`>'".$wo_rank['p_score']."' order by p_grade desc limit 60");
while($row=$db->fetch_array($query)) $rank_list30_2[]=$row;
$query=$db->query("select * from player_info where `p_score`>'".$wo_rank['p_score']."' order by p_grade desc limit 30");
while($row=$db->fetch_array($query)) $rank_list30_1[]=$row;
*/
?>
<!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;
}
a.info {
position:relative; z-index:0; color:#000; text-decoration:none;}
a.info:hover {
z-index:1; background-color:#000000;}
a.info span {
display: none;}
a.info:hover span { display:block; position:absolute; padding-left:0px; padding-top:5px; padding-bottom:5px;width:260px; border:2px solid #fff; line-height:16px; background-color:#E7CB94; color:#000000; text-align: left; text-decoration:none; }
</style>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
var curPID;
function showMenu(y, pname)
{
var menu = document.all.pMenu;
if (menu.style.display == '') menuClose();
player = pname;
document.all.menuName.innerText = '对 ' + player + ' 的军事行动';
document.all.menuMessage.innerText = '发送消息';
document.all.menuAttackThieves1.innerText = '窃取情报';
document.all.menuAttackThieves2.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="menuAttackThieves1" onmouseover="menuOver(this)" onmouseout="menuOut(this)" onclick="menuEflag('armament_action.php?action_type=3')"></td></tr>
<tr><td class="menuItem" style="text-align:left; cursor:hand;" id="menuAttackThieves2" onmouseover="menuOver(this)" onmouseout="menuOut(this)" onclick="menuEflag('armament_action.php?action_type=0')"></td></tr>
<tr><td><hr noshade size="1"></td></tr>
<tr><td class="menuItem" id="menuClose" style="cursor:hand;" onmouseover="menuOver(this)" onmouseout="menuOut(this)" onclick="menuClose()"></td></tr>
</table>
</div>
<!--导航-->
<div id="tc_02">
<div id="mb_0">
<div id="mc_01" class="black_18"><a href="world_map.php" target="main">地 图</a></div>
</div>
<div id="mb_2">
<div id="mc_01" class="black_18"><a href="score_rank.php" target="main">排行榜</a><a name="#rank"></a></div>
</div>
</div>
<div id="mb_01">
<div class="page_build_title">排行榜</div>
</div>
<div id="mb_04">
<!--替换区域开始-->
<?php if($rank_list5<>"") { ?>
<table width="90%" border=1 cellpadding=1 cellspacing=0 style="margin-top:20px; font-size:12px;border-collapse:collapse;border:1px solid threeddarkshadow" bordercolor="threeddarkshadow" align="center">
<tr bgcolor="darkslategray" height="25">
<td align="center" colspan="10"><span style="color:#ffffff; font-weight:bold;">排 行 榜(等级相同的则以经验排序)</span></td>
</tr>
<tr height="25" style="font-weight:bold;">
<td align="center" width="35%" >玩家</td>
<td align="center" width="10%">国家</td>
<td align="center" width="8%">等级</td>
<td align="center" width="25%">联盟</td>
<td align="center" width="10%">排名</td>
</tr>
<?php foreach ($rank_list5 as $i=>$m) {
$query=$db->query("select c_area,c_area_x,c_area_y from city where `u_id`='".$m['u_id']."' and `c_type`='1'");
$city_info = $db->fetch_array($query);
$query_on=$db->query("select * from online where u_id='".$m['u_id']."'");
$online=$db->fetch_array($query_on);
?>
<tr <?php if($m['u_id']==$UserId) echo "bgcolor=#00FFFF";?> height="20">
<td align="left" style="padding-left:5px;">
<a href="#none" class="d">
<?php //echo $m['p_nickname'];?>
<span>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FFFFCC">
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="45%" align="center">
<div align="center">
<img src="img/header_<?php echo $m['sex'];?>/<?php echo $m['p_head_img'];?>.jpg" width="75" height="75" /"><br />
<?php echo $m['p_nickname'];?> <?php if($online['u_id']) echo "<font color=\"RED\">在线</font>";else echo "离线";?>
</div> </td>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr bgcolor="#FFFFCC">
<td bgcolor="#FFFFCC" align="center" colspan="2">
</td>
</tr>
<tr bgcolor="#FFFFCC" align="center">
<td width="49%" height="35" ><a href="message_put.php?e_username=<?php echo $m['p_nickname'];?>" target="_self">发送消息</a></td>
<td width="51%" height="35"><a href="armament_action.php?action_type=3&x=<?php echo $city_info['c_area'];?>&y=<?php echo $city_info['c_area_x'];?>">窃取情报</a></td>
</tr>
<tr bgcolor="#FFFFCC" align="center">
<td height="35"><a href="friend.php?nickname=<?php echo $m['p_nickname'];?>" target="_self">加为好友</a></td>
<td height="35"><a href="armament_action.php?action_type=0&x=<?php echo $city_info['c_area'];?>&y=<?php echo $city_info['c_area_x'];?>">掠夺资源</a></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</span>
</a>
</td>
<td align="center"><?php echo $country_num[$m['p_country']];?></td>
<td align="center" class="SMALL"><?php echo $m['p_grade'];?></td>
<td align="center"><?php if($m['union_id']>0) echo "<a href=\"union.php?action=listunion&id=".$m['union_id']."\">".$m['union_name']."</a>";else echo "无";?></td>
<td align="center"><font color="RED"><?php echo $i+1;?></font></td>
</tr>
<?php } ?>
</table>
<?php }elseif($rank_list5==""){ ?>
<div id="building_description" class="task_title">暂无排行</div>
<?php } ?>
<?php $db->close();?>
<!--替换区域结束-->
</div>
</div>
<div id="mb_03"></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -