parent
ec7a26a582
commit
3340847e38
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
class server_status extends AmysqlController {
|
||||||
|
function getinfo() {
|
||||||
|
$info = $this -> _model('server_model') -> QueryMinecraft( $_REQUEST ['ip'], $_REQUEST ['port'] );
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
|
@ -4,7 +4,9 @@ class user_current extends AmysqlController
|
||||||
function current()
|
function current()
|
||||||
{
|
{
|
||||||
$money = $this -> _model('current_model') -> money_current($_REQUEST['user']);
|
$money = $this -> _model('current_model') -> money_current($_REQUEST['user']);
|
||||||
|
if(!$money){
|
||||||
|
JsonError( "未查询到账号信息!" );
|
||||||
|
}
|
||||||
JsonSuccess( $money );
|
JsonSuccess( $money );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
class current_model extends AmysqlModel {
|
class current_model extends AmysqlModel {
|
||||||
function money_current($user) {
|
function money_current($user) {
|
||||||
$sql = "SELECT * FROM `iconomy` WHERE `username` = '" . $user;
|
$sql = "SELECT * FROM `iconomy` WHERE `username` = '" . $user . "'";
|
||||||
return $this->_all ( $sql );
|
return $this->_row ( $sql );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
class server_model extends AmysqlModel {
|
||||||
|
function QueryMinecraft($IP, $Port = 25565, $Timeout = 2) {
|
||||||
|
$Socket = Socket_Create ( AF_INET, SOCK_STREAM, SOL_TCP );
|
||||||
|
|
||||||
|
Socket_Set_Option ( $Socket, SOL_SOCKET, SO_SNDTIMEO, array (
|
||||||
|
'sec' => ( int ) $Timeout,
|
||||||
|
'usec' => 0
|
||||||
|
) );
|
||||||
|
Socket_Set_Option ( $Socket, SOL_SOCKET, SO_RCVTIMEO, array (
|
||||||
|
'sec' => ( int ) $Timeout,
|
||||||
|
'usec' => 0
|
||||||
|
) );
|
||||||
|
|
||||||
|
if ($Socket === FALSE || @Socket_Connect ( $Socket, $IP, ( int ) $Port ) === FALSE) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Socket_Send ( $Socket, "\xFE\x01", 2, 0 );
|
||||||
|
// Socket_Send ( $Socket, "\x0F\0x00\x04\x09\x31\x32\x37\x2E\x30\x2E\x30\x2E\x31\x63\xDD\x01", 16, 0);
|
||||||
|
// Socket_Send ( $Socket, "\x01\x00", 2, 0 );
|
||||||
|
$Len = Socket_Recv ( $Socket, $Data, 1024, 0 );
|
||||||
|
Socket_Close ( $Socket );
|
||||||
|
|
||||||
|
// return FALSE;
|
||||||
|
// if ($Len < 4 || $Data [0] !== "\xFF") {
|
||||||
|
// return FALSE;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $Data = SubStr ( $Data, 3 );
|
||||||
|
echo($Len);
|
||||||
|
echo("</p>");
|
||||||
|
|
||||||
|
// $Data = iconv( 'UTF-16BE', 'UTF-8', $Data );
|
||||||
|
print_r($Data);
|
||||||
|
echo("</p>");
|
||||||
|
$zData = Explode ( "\x00", $Data );
|
||||||
|
echo(count($zData));
|
||||||
|
echo("</p>");
|
||||||
|
print_r($zData);
|
||||||
|
echo("</p>");
|
||||||
|
$aData = Explode ( "\xA7", $Data );
|
||||||
|
echo(count($aData));
|
||||||
|
echo("</p>");
|
||||||
|
print_r($aData);
|
||||||
|
// if ($Data [1] === "\xA7" && $Data [2] === "\x31") {
|
||||||
|
// $Data = Explode ( "\x00", $Data );
|
||||||
|
// var_dump($Data [3]);
|
||||||
|
// return Array (
|
||||||
|
// 'HostName' => $Data [3],
|
||||||
|
// 'Players' => IntVal ( $Data [4] ),
|
||||||
|
// 'MaxPlayers' => IntVal ( $Data [5] ),
|
||||||
|
// 'Protocol' => IntVal ( $Data [1] ),
|
||||||
|
// 'Version' => $Data [2]
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $Data = Explode ( "\xA7", $Data );
|
||||||
|
// return Array (
|
||||||
|
// 'HostName' => SubStr ( $Data [0], 0, - 1 ),
|
||||||
|
// 'Players' => isset ( $Data [1] ) ? IntVal ( $Data [1] ) : 0,
|
||||||
|
// 'MaxPlayers' => isset ( $Data [2] ) ? IntVal ( $Data [2] ) : 0,
|
||||||
|
// 'Protocol' => 0,
|
||||||
|
// 'Version' => '1.3'
|
||||||
|
// );
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,27 +3,41 @@
|
||||||
<script src="http://apps.bdimg.com/libs/html5shiv/3.7/html5shiv.min.js"></script>
|
<script src="http://apps.bdimg.com/libs/html5shiv/3.7/html5shiv.min.js"></script>
|
||||||
<script src="http://apps.bdimg.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
<script src="http://apps.bdimg.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
<!-- navbar -->
|
||||||
<div class="navbar navbar-inverse">
|
<div class="navbar navbar-inverse">
|
||||||
<div class="navbar-inner">
|
<div class="navbar-inner">
|
||||||
<button type="button" class="btn btn-navbar visible-phone"
|
<a class="brand" href="<?=Url('index' , 'index')?>"><img
|
||||||
id="menu-toggler">
|
src="View/public/img/logo.png" /></a>
|
||||||
|
<button type="button" class="btn btn-navbar" data-toggle="collapse"
|
||||||
|
data-target=".nav-collapse">
|
||||||
<span class="icon-bar"></span> <span class="icon-bar"></span> <span
|
<span class="icon-bar"></span> <span class="icon-bar"></span> <span
|
||||||
class="icon-bar"></span>
|
class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
|
<div class="nav-collapse collapse">
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
<a class="brand" href="index.php">Minecraft用户中心</a>
|
<li class="active"><a href="index.php"> <i class="icon-home"></i> <span>首页</span>
|
||||||
|
</a></li>
|
||||||
|
|
||||||
<ul class="nav pull-right">
|
<li><a href="<?=Url('index' , 'pass')?>"> <i class="icon-group"></i>
|
||||||
<li class="dropdown"><a href="#" class="dropdown-toggle hidden-phone"
|
<span>修改密码</span>
|
||||||
data-toggle="dropdown">
|
</a></li>
|
||||||
已登陆玩家:<?=$_SESSION['username']?>
|
<li><a href="<?=Url('index','mail')?>"> <i class="icon-picture"></i>
|
||||||
|
<span>验证邮箱</span>
|
||||||
|
</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li class="dropdown"><a href="#"
|
||||||
|
class="dropdown-toggle hidden-phone" data-toggle="dropdown">
|
||||||
|
已登陆玩家:<?=$_SESSION['username']?>
|
||||||
<b class="caret"></b>
|
<b class="caret"></b>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="<?=Url('user_public','logout')?>"><i class="icon-off"></i>
|
||||||
<li><a href="<?=Url('user_public','logout')?>"><i class="icon-off"></i>
|
退出</a></li>
|
||||||
退出</a></li>
|
</ul></li>
|
||||||
</ul></li>
|
</ul>
|
||||||
</ul>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- end navbar -->
|
|
@ -44,7 +44,7 @@ if (empty ( $_SESSION ['username'] ))
|
||||||
<!-- end navbar -->
|
<!-- end navbar -->
|
||||||
|
|
||||||
<!-- sidebar -->
|
<!-- sidebar -->
|
||||||
<? include 'left.php';?>
|
<?=load('left')?>
|
||||||
<!-- end sidebar -->
|
<!-- end sidebar -->
|
||||||
|
|
||||||
|
|
||||||
|
|
248
View/message.php
248
View/message.php
|
@ -1,128 +1,100 @@
|
||||||
<?php
|
<?php
|
||||||
if (empty ( $_SESSION ['username'] ))
|
if (empty ( $_SESSION ['username'] ))
|
||||||
header ( "Location:" . Url ( 'index', 'login' ) );
|
header ( "Location:" . Url ( 'index', 'login' ) );
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title><?=$title?></title>
|
<title><?=$title?></title>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
<!-- bootstrap -->
|
<!-- bootstrap -->
|
||||||
<link href="View/public/css/bootstrap/bootstrap.css" rel="stylesheet" />
|
<link href="View/public/css/bootstrap/bootstrap.css" rel="stylesheet" />
|
||||||
<link href="View/public/css/bootstrap/bootstrap-responsive.css"
|
<link href="View/public/css/bootstrap/bootstrap-responsive.css"
|
||||||
rel="stylesheet" />
|
rel="stylesheet" />
|
||||||
<link href="View/public/css/bootstrap/bootstrap-overrides.css"
|
<link href="View/public/css/bootstrap/bootstrap-overrides.css"
|
||||||
type="text/css" rel="stylesheet" />
|
type="text/css" rel="stylesheet" />
|
||||||
|
|
||||||
<!-- global styles -->
|
<!-- global styles -->
|
||||||
<link rel="stylesheet" type="text/css" href="View/public/css/layout.css" />
|
<link rel="stylesheet" type="text/css" href="View/public/css/layout.css" />
|
||||||
<link rel="stylesheet" type="text/css"
|
<link rel="stylesheet" type="text/css"
|
||||||
href="View/public/css/elements.css" />
|
href="View/public/css/elements.css" />
|
||||||
<link rel="stylesheet" type="text/css" href="View/public/css/icons.css" />
|
<link rel="stylesheet" type="text/css" href="View/public/css/icons.css" />
|
||||||
|
|
||||||
<!-- libraries -->
|
<!-- libraries -->
|
||||||
<link rel="stylesheet" type="text/css"
|
<link rel="stylesheet" type="text/css"
|
||||||
href="View/public/css/lib/font-awesome.css" />
|
href="View/public/css/lib/font-awesome.css" />
|
||||||
|
|
||||||
<!-- this page specific styles -->
|
<!-- this page specific styles -->
|
||||||
<link rel="stylesheet" href="View/public/css/compiled/personal-info.css"
|
<link rel="stylesheet" href="View/public/css/compiled/personal-info.css"
|
||||||
type="text/css" media="screen" />
|
type="text/css" media="screen" />
|
||||||
|
|
||||||
<!-- open sans font -->
|
<!-- open sans font -->
|
||||||
<link
|
<link
|
||||||
href='http://fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800'
|
href='http://fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800'
|
||||||
rel='stylesheet' type='text/css' />
|
rel='stylesheet' type='text/css' />
|
||||||
|
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<!-- navbar -->
|
<!-- navbar -->
|
||||||
<div class="navbar navbar-inverse">
|
<?=load('header')?>
|
||||||
<div class="navbar-inner">
|
<!-- end navbar -->
|
||||||
<a class="brand" href="<?=Url('index' , 'index')?>"><img src="View/public/img/logo.png" /></a>
|
|
||||||
<button type="button" class="btn btn-navbar" data-toggle="collapse"
|
<!-- main container .wide-content is used for this layout without sidebar :) -->
|
||||||
data-target=".nav-collapse">
|
<div class="content wide-content col-xs-12 col-md-12 col-lg-12">
|
||||||
<span class="icon-bar"></span> <span class="icon-bar"></span> <span
|
<div class="container-fluid">
|
||||||
class="icon-bar"></span>
|
<div class="settings-wrapper" id="pad-wrapper">
|
||||||
</button>
|
<!-- avatar column -->
|
||||||
<div class="nav-collapse collapse">
|
<div class="span3 avatar-box">
|
||||||
<ul class="nav">
|
<div class="personal-image">
|
||||||
|
<img src="View/public/tx.jpg" class="avatar img-circle" />
|
||||||
<li class="active"><a href="index.php"> <i class="icon-home"></i> <span>首页</span>
|
</div>
|
||||||
</a></li>
|
</div>
|
||||||
|
|
||||||
<li><a href="<?=Url('index' , 'pass')?>"> <i class="icon-group"></i>
|
<!-- edit form column -->
|
||||||
<span>修改密码</span>
|
<div class="span7 personal-info">
|
||||||
</a></li>
|
<h5 class="personal-title">Minecraft玩家信息</h5>
|
||||||
<li><a href="<?=Url('index','mail')?>"> <i class="icon-picture"></i>
|
|
||||||
<span>验证邮箱</span>
|
<form>
|
||||||
</a></li>
|
<div class="field-box">
|
||||||
</ul>
|
<label>游戏帐号:</label> <input class="span3 inline-input" id="user"
|
||||||
<ul class="nav pull-right">
|
type="text" value="<?=$_SESSION['username']?>"
|
||||||
<li class="dropdown"><a href="#" class="dropdown-toggle hidden-phone" data-toggle="dropdown">
|
disabled="disabled" />
|
||||||
已登陆玩家:<?=$_SESSION['username']?>
|
</div>
|
||||||
<b class="caret"></b>
|
<div class="field-box">
|
||||||
</a>
|
<label>邮箱地址:</label> <input class="span3 inline-input" id="mail"
|
||||||
<ul class="dropdown-menu">
|
type="text" value="" disabled="disabled" /> <span id="status"></span>
|
||||||
<li><a href="<?=Url('user_public','logout')?>"><i
|
</div>
|
||||||
class="icon-off"></i> 退出</a></li>
|
<div class="field-box">
|
||||||
</ul></li>
|
<label>游戏币余额:</label> <input class="span3 inline-input"
|
||||||
</ul>
|
id="money" type="text" value="" disabled="disabled" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="field-box">
|
||||||
</div>
|
<label>服务器信息:</label> 在线人数: <span id="now" ></span>/<span id="max" ></span>
|
||||||
<!-- end navbar -->
|
</div>
|
||||||
|
</form>
|
||||||
<!-- main container .wide-content is used for this layout without sidebar :) -->
|
</div>
|
||||||
<div class="content wide-content col-xs-12 col-md-12 col-lg-12">
|
</div>
|
||||||
<div class="container-fluid">
|
</div>
|
||||||
<div class="settings-wrapper" id="pad-wrapper">
|
</div>
|
||||||
<!-- avatar column -->
|
<!-- end main container -->
|
||||||
<div class="span3 avatar-box">
|
|
||||||
<div class="personal-image">
|
|
||||||
<img src="View/public/tx.jpg" class="avatar img-circle" />
|
<!-- scripts -->
|
||||||
</div>
|
<script src="View/public/js/jquery-latest.js"></script>
|
||||||
</div>
|
<script src="View/public/js/bootstrap.min.js"></script>
|
||||||
|
<script src="View/public/js/theme.js"></script>
|
||||||
<!-- edit form column -->
|
|
||||||
<div class="span7 personal-info">
|
|
||||||
<h5 class="personal-title">Minecraft玩家信息</h5>
|
|
||||||
|
|
||||||
<form>
|
|
||||||
<div class="field-box">
|
|
||||||
<label>游戏帐号:</label> <input class="span5 inline-input" id="user"
|
|
||||||
type="text" value="<?=$_SESSION['username']?>"
|
|
||||||
disabled="disabled" />
|
|
||||||
</div>
|
|
||||||
<div class="field-box">
|
|
||||||
<label>邮箱地址:</label> <input class="span5 inline-input" id="mail"
|
|
||||||
type="text" value="" disabled="disabled" /><p id="status"></p>
|
|
||||||
</div>
|
|
||||||
<div class="field-box">
|
|
||||||
<label>游戏币余额:</label> <input class="span5 inline-input" id="money"
|
|
||||||
type="text" value="" disabled="disabled" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- end main container -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- scripts -->
|
|
||||||
<script src="View/public/js/jquery-latest.js"></script>
|
|
||||||
<script src="View/public/js/bootstrap.min.js"></script>
|
|
||||||
<script src="View/public/js/theme.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
select();
|
select();
|
||||||
status();
|
status();
|
||||||
|
current();
|
||||||
|
getinfo();
|
||||||
var data = "user=<?=$_SESSION['username']?>";
|
var data = "user=<?=$_SESSION['username']?>";
|
||||||
function select(){
|
function select(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -156,9 +128,11 @@ if (empty ( $_SESSION ['username'] ))
|
||||||
{
|
{
|
||||||
if(content.statu == 0)
|
if(content.statu == 0)
|
||||||
{
|
{
|
||||||
$("#status").html("邮箱验证状态:尚未验证");
|
$("#status").html("邮箱验证状态:尚未验证");
|
||||||
|
$("#status").css("color", "red");
|
||||||
}else{
|
}else{
|
||||||
$('#status').html("邮箱验证状态:已验证");
|
$('#status').html("邮箱验证状态:已验证");
|
||||||
|
$("#status").css("color", "green");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -170,12 +144,10 @@ if (empty ( $_SESSION ['username'] ))
|
||||||
}
|
}
|
||||||
window.onload = function(){
|
window.onload = function(){
|
||||||
var html = $('#status').html();
|
var html = $('#status').html();
|
||||||
//document.write(html);
|
|
||||||
if(html.indexOf("尚未验证") != -1){
|
if(html.indexOf("尚未验证") != -1){
|
||||||
$('#status').html($('#status').html()+ " <a href='<?=Url('index', 'mail')?>' onclick='display()'>点击这里进行验证</a>")
|
$('#status').html($('#status').html()+ " <a href='<?=Url('index', 'mail')?>' onclick='display()'>点击这里进行验证</a>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
current();
|
|
||||||
function current(){
|
function current(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"GET",
|
type:"GET",
|
||||||
|
@ -183,20 +155,32 @@ if (empty ( $_SESSION ['username'] ))
|
||||||
data:{user:"<?=$_SESSION['username']?>"},
|
data:{user:"<?=$_SESSION['username']?>"},
|
||||||
url:"<?=Url('user_current' , 'current')?>",
|
url:"<?=Url('user_current' , 'current')?>",
|
||||||
success:function(rdata){
|
success:function(rdata){
|
||||||
$.each(rdata.info,function(index,content)
|
$("#money").val( rdata.info );
|
||||||
{
|
|
||||||
if(rdata.status == "success")
|
|
||||||
{
|
|
||||||
$("#money").val( content.balance );
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
error:function(){
|
error:function(){
|
||||||
alert("尚未查询到此用户的游戏币余额");
|
alert("尚未查询到此用户的游戏币余额");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
function getinfo(){
|
||||||
|
$.ajax({
|
||||||
|
type:"GET",
|
||||||
|
dataType:"json",
|
||||||
|
data:{ip:"play.i5mc.com"},
|
||||||
|
url:"https://mcapi.us/server/status",
|
||||||
|
success:function(rdata){
|
||||||
|
if(rdata.status=="success"){
|
||||||
|
$("#max").html( rdata.players.max );
|
||||||
|
$("#now").html( rdata.players.now );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error:function(){
|
||||||
|
alert("尚未查询到服务器信息");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title><?=$title?></title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue