1
0
mirror of https://e.coding.net/circlecloud/McAccount.git synced 2024-11-22 01:48:55 +00:00

更新项目...

Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
j502647092 2015-11-01 22:29:21 +08:00
parent 17a9ae06a2
commit 5425b2b1e4
6 changed files with 58 additions and 147 deletions

View File

@ -186,10 +186,9 @@ class AmysqlController {
include_once ($file); include_once ($file);
if (! class_exists ( $ClassName )) if (! class_exists ( $ClassName ))
Amysql::AmysqlNotice ( $ClassName . ' 模型对象不存在' ); Amysql::AmysqlNotice ( $ClassName . ' 模型对象不存在' );
$this->DBConfig ['ModelTag'] = $ModelTag = $ClassName . '_' . $this->DBConfig ['ConnectTag']; // 模型标识 $this->DBConfig ['ModelTag'] = $ModelTag = $ClassName . '_' . $this->DBConfig ['ConnectTag']; // 模型标识
if (! isset ( $this->AmysqlModel [$ModelTag] )) // 不存在模型 // 不存在模型
{ if (! isset ( $this->AmysqlModel [$ModelTag] )) {
$this->AmysqlModel [$ModelTag] = new $ClassName (); $this->AmysqlModel [$ModelTag] = new $ClassName ();
if (! isset ( $this->DB->DBS [$ModelTag] )) if (! isset ( $this->DB->DBS [$ModelTag] ))
$this->DB->DBConnect ( $this->DBConfig ); // 没连接就进行数据库连接 $this->DB->DBConnect ( $this->DBConfig ); // 没连接就进行数据库连接
@ -344,9 +343,12 @@ class AmysqlModel {
/** /**
* 更新数据 * 更新数据
* *
* @param string $table 表名 * @param string $table
* @param Array $data 数据 * 表名
* @param string $where 更新数据依据 * @param Array $data
* 数据
* @param string $where
* 更新数据依据
* @return int Affected 影响数 * @return int Affected 影响数
* *
*/ */

View File

@ -1,37 +1,28 @@
<?php <?php
class index extends AmysqlController {
class index extends AmysqlController
{
// 默认首页 // 默认首页
function IndexAction() function IndexAction() {
{ $this->title = 'Minecraft 用户中心'; // 直接赋值模板
$this -> title = 'Minecraft 用户中心'; // 直接赋值模板 $this->_view ( 'message' ); // 载入index模板
$this -> _view('message'); // 载入index模板
} }
function login() {
function login(){ $this->title = "Minecraft 用户登陆";
$this -> title = "Minecraft 用户登陆"; $this->_view ( 'login' );
$this -> _view('login');
} }
function register(){ function register() {
$this -> title = "Minecraft 帐号注册"; $this->title = "Minecraft 帐号注册";
$this -> _view("register"); $this->_view ( "register" );
} }
function pass() {
function pass(){ $this->title = "Minecraft 修改密码";
$this -> title = "Minecraft 修改密码"; $this->_view ( "password" );
$this -> _view("password");
} }
function mail() {
function mail(){ $this->title = "Minecraft 邮箱验证";
$this -> title = "Minecraft 邮箱验证"; $this->_View ( "mail/mailstatus" );
$this -> _View("mail/mailstatus");
} }
function forge(){ function forge() {
$this -> title = "Minecraft 密码找回"; $this->title = "Minecraft 密码找回";
$this -> _View("forge"); $this->_View ( "forge" );
} }
} }

View File

@ -23,7 +23,7 @@ class mail_status extends AmysqlController {
JsonError ( '验证码不对!请重试' ); JsonError ( '验证码不对!请重试' );
exit ( 0 ); exit ( 0 );
} }
if ($this->_model ( "mail_model" )->mail ( @$_REQUEST ['mail'], $verify, @$_SESSION ['username'] )) if ($this->_model ( "mail_model" )->mail ( @$_REQUEST ['mail'], @$_SESSION ['username'] ))
JsonSuccess ( '验证成功' ); JsonSuccess ( '验证成功' );
else else
JsonError ( "验证失败" ); JsonError ( "验证失败" );

View File

@ -1,8 +0,0 @@
<?php
class server_status extends AmysqlController {
function getinfo() {
$info = $this -> _model('server_model') -> QueryMinecraft( $_REQUEST ['ip'], $_REQUEST ['port'] );
return $info;
}
}
?>

View File

@ -4,21 +4,14 @@ class mail_model extends AmysqlModel {
$sql = "SELECT email FROM `authme` WHERE `username` = '" . $where . "'"; $sql = "SELECT email FROM `authme` WHERE `username` = '" . $where . "'";
return $this->_all ( $sql ); return $this->_all ( $sql );
} }
public function mail($mail, $verify, $user) { public function mail($mail, $user) {
$data = array ( $data = array (
"address" => $mail, "address" => $mail,
"verify" => $verify,
"statu" => '1', "statu" => '1',
"time" => date ( "Y-m-d" ) "time" => date ( "Y-m-d" )
); );
// var_dump($data); // var_dump($data);
$num = $this->_update ( 'mail', $data, "WHERE user='" . $user . "'" ); return $this->_update ( 'mail', $data, "WHERE user='" . $user . "'" ) != 0;
// var_dump($num);
if ($num == 0) {
return false;
} else {
return true;
}
} }
public function status($user) { public function status($user) {
$sql = "SELECT * FROM `mail` WHERE `user` = '" . $user . "'"; $sql = "SELECT * FROM `mail` WHERE `user` = '" . $user . "'";

View File

@ -1,67 +0,0 @@
<?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'
// );
}
}