1
0
mirror of https://e.coding.net/circlecloud/McAccount.git synced 2024-11-21 01:38: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

@ -35,7 +35,7 @@ class Amysql {
* **********************************************
*
* 总进程对象
*
*
* @param Object $ControllerName
* @param string $ControllerName
* @param string $ActionName
@ -89,7 +89,7 @@ class AmysqlProcess {
* **********************************************
*
* 控制器逻辑层 (C)
*
*
* @param Object $DB
* @param Array $DBConfig
* @param Array $AmysqlModel
@ -114,7 +114,7 @@ class AmysqlController {
/**
* 设置数据库配置
*
*
* @param Array $Config
*/
function _DBSet($_Config = NULL) {
@ -127,7 +127,7 @@ class AmysqlController {
/**
* 模板赋值
*
*
* @param string $name
* @param string $value
*/
@ -137,7 +137,7 @@ class AmysqlController {
/**
* 数组模板赋值
*
*
* @param Array $array
*/
public function _array($array) {
@ -149,7 +149,7 @@ class AmysqlController {
/**
* 加载自定义类文件
*
*
* @param string $file
* @param string $ClassName
* @return Object $ClassName() 类对象
@ -173,7 +173,7 @@ class AmysqlController {
/**
* 加载模型文件
*
*
* @param string $file
* @param string $ClassName
* @return Object $ClassName() 模型对象
@ -186,10 +186,9 @@ class AmysqlController {
include_once ($file);
if (! class_exists ( $ClassName ))
Amysql::AmysqlNotice ( $ClassName . ' 模型对象不存在' );
$this->DBConfig ['ModelTag'] = $ModelTag = $ClassName . '_' . $this->DBConfig ['ConnectTag']; // 模型标识
if (! isset ( $this->AmysqlModel [$ModelTag] )) // 不存在模型
{
// 不存在模型
if (! isset ( $this->AmysqlModel [$ModelTag] )) {
$this->AmysqlModel [$ModelTag] = new $ClassName ();
if (! isset ( $this->DB->DBS [$ModelTag] ))
$this->DB->DBConnect ( $this->DBConfig ); // 没连接就进行数据库连接
@ -203,7 +202,7 @@ class AmysqlController {
/**
* 获得相关文件数据(模板目录)
*
*
* @param string $file
* @return string 数据
*/
@ -218,7 +217,7 @@ class AmysqlController {
/**
* 数据调试
*
*
* @param $data 数据
*/
public function _echo($data) {
@ -253,7 +252,7 @@ class AmysqlController {
* **********************************************
*
* 视图表现层 (V)
*
*
* @param Array $TemplateValue
*
*/
@ -282,7 +281,7 @@ class AmysqlTemplates {
* **********************************************
*
* 模型数据层 (M)
*
*
* @param Object $MysqlConnect
* @param String $Affected
* @param String $InsertId
@ -299,7 +298,7 @@ class AmysqlModel {
/**
* 基本查询
*
*
* @param string $sql
* @return Object 结果集
*/
@ -321,7 +320,7 @@ class AmysqlModel {
/**
* 插入数据
*
*
* @param string $table
* @param Array $data
* @return int InsertId 新增ID
@ -343,12 +342,15 @@ class AmysqlModel {
/**
* 更新数据
*
* @param string $table 表名
* @param Array $data 数据
* @param string $where 更新数据依据
*
* @param string $table
* 表名
* @param Array $data
* 数据
* @param string $where
* 更新数据依据
* @return int Affected 影响数
*
*
*/
public function _update($table, $data, $where = '') {
$this->Affected = 0;
@ -366,7 +368,7 @@ class AmysqlModel {
/**
* 取得一排数据
*
*
* @param string $sql
* @param string $result_type
* @return Array $row 数据
@ -383,7 +385,7 @@ class AmysqlModel {
/**
* 取得所有数据
*
*
* @param string $sql
* @param string $result_type
* @return Array $row 数据
@ -404,7 +406,7 @@ class AmysqlModel {
/**
* 取得数据总数
*
*
* @param string $sql
* @return int 数量
*/
@ -417,7 +419,7 @@ class AmysqlModel {
/**
* 释放结果集
*
*
* @param Object $rs
*/
public function _free($rs) {
@ -429,7 +431,7 @@ class AmysqlModel {
* **********************************************
*
* 数据库对象
*
*
* @param Object $DBS
*/
class DB {

View File

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

View File

@ -23,7 +23,7 @@ class mail_status extends AmysqlController {
JsonError ( '验证码不对!请重试' );
exit ( 0 );
}
if ($this->_model ( "mail_model" )->mail ( @$_REQUEST ['mail'], $verify, @$_SESSION ['username'] ))
if ($this->_model ( "mail_model" )->mail ( @$_REQUEST ['mail'], @$_SESSION ['username'] ))
JsonSuccess ( '验证成功' );
else
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 . "'";
return $this->_all ( $sql );
}
public function mail($mail, $verify, $user) {
public function mail($mail, $user) {
$data = array (
"address" => $mail,
"verify" => $verify,
"statu" => '1',
"time" => date ( "Y-m-d" )
);
// var_dump($data);
$num = $this->_update ( 'mail', $data, "WHERE user='" . $user . "'" );
// var_dump($num);
if ($num == 0) {
return false;
} else {
return true;
}
return $this->_update ( 'mail', $data, "WHERE user='" . $user . "'" ) != 0;
}
public function status($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'
// );
}
}