mirror of
https://e.coding.net/circlecloud/McAccount.git
synced 2024-11-17 00:58:57 +00:00
fix MySQL error and fix message.php...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
af6a38d957
commit
ec7a26a582
@ -24,10 +24,10 @@ class Amysql {
|
||||
}
|
||||
static public function filter(&$array, $function) {
|
||||
if (! is_array ( $array ))
|
||||
Return $array = $function ( $array );
|
||||
return $array = $function ( $array );
|
||||
foreach ( $array as $key => $value )
|
||||
(is_array ( $value ) && $array [$key] = Amysql::filter ( $value, $function )) || $array [$key] = $function ( $value );
|
||||
Return $array;
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ class AmysqlController {
|
||||
|
||||
if (! isset ( $this->AmysqlClass [$ClassName] )) // 不存在类对象
|
||||
$this->AmysqlClass [$ClassName] = new $ClassName ();
|
||||
Return $this->AmysqlClass [$ClassName];
|
||||
return $this->AmysqlClass [$ClassName];
|
||||
}
|
||||
|
||||
Amysql::AmysqlNotice ( $file . ' 类文件不存在' );
|
||||
@ -195,7 +195,7 @@ class AmysqlController {
|
||||
$this->DB->DBConnect ( $this->DBConfig ); // 没连接就进行数据库连接
|
||||
$this->AmysqlModel [$ModelTag]->MysqlConnect = $this->DB->DBS [$ModelTag]; // 模型使用的数据库连接
|
||||
}
|
||||
Return $this->AmysqlModel [$ModelTag];
|
||||
return $this->AmysqlModel [$ModelTag];
|
||||
}
|
||||
|
||||
Amysql::AmysqlNotice ( $file . ' 模型文件不存在' );
|
||||
@ -211,7 +211,7 @@ class AmysqlController {
|
||||
$file = str_replace ( _PathTag, DIRECTORY_SEPARATOR, $file );
|
||||
$file = _View . $file . '.php';
|
||||
if (is_file ( $file ))
|
||||
Return file_get_contents ( $file );
|
||||
return file_get_contents ( $file );
|
||||
|
||||
Amysql::AmysqlNotice ( $file . ' 数据文件不存在' );
|
||||
}
|
||||
@ -272,7 +272,7 @@ class AmysqlTemplates {
|
||||
$file = str_replace ( _PathTag, DIRECTORY_SEPARATOR, $file );
|
||||
$file = _View . $file . '.php';
|
||||
if (is_file ( $file ))
|
||||
Return include ($file);
|
||||
return include ($file);
|
||||
|
||||
Amysql::AmysqlNotice ( $file . ' 模板文件不存在' );
|
||||
}
|
||||
@ -306,17 +306,17 @@ class AmysqlModel {
|
||||
public function _query($sql) {
|
||||
global $Config;
|
||||
if (! $this->MysqlConnect)
|
||||
Return false;
|
||||
return false;
|
||||
$this->QueryStatus = '(0)';
|
||||
$this->Affected = 0;
|
||||
if ($Config ['DebugSql'])
|
||||
$this->SqlBug .= "\n" . '<!--DebugSql: ' . $sql . '-->' . "\n";
|
||||
$result = mysql_query ( $sql, $this->MysqlConnect );
|
||||
if (! $result)
|
||||
Return false;
|
||||
return false;
|
||||
$this->Affected = mysql_affected_rows ();
|
||||
$this->QueryStatus = '(ok)';
|
||||
Return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -329,7 +329,7 @@ class AmysqlModel {
|
||||
public function _insert($table, $data) {
|
||||
$this->InsertId = 0;
|
||||
if (! is_array ( $data ) || count ( $data ) == 0)
|
||||
Return 0;
|
||||
return 0;
|
||||
|
||||
$field_arr = array ();
|
||||
foreach ( $data as $key => $val )
|
||||
@ -338,7 +338,7 @@ class AmysqlModel {
|
||||
$sql = "INSERT INTO `$table` SET " . implode ( ',', $field_arr );
|
||||
$this->_query ( $sql );
|
||||
$this->InsertId = mysql_insert_id ();
|
||||
Return $this->InsertId;
|
||||
return $this->InsertId;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -353,7 +353,7 @@ class AmysqlModel {
|
||||
public function _update($table, $data, $where = '') {
|
||||
$this->Affected = 0;
|
||||
if (! is_array ( $data ) || count ( $data ) == 0)
|
||||
Return 0;
|
||||
return 0;
|
||||
|
||||
$field_arr = array ();
|
||||
foreach ( $data as $key => $val )
|
||||
@ -361,7 +361,7 @@ class AmysqlModel {
|
||||
|
||||
$sql = "UPDATE `$table` SET " . implode ( ',', $field_arr ) . $where;
|
||||
$this->_query ( $sql );
|
||||
Return $this->Affected;
|
||||
return $this->Affected;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -374,11 +374,11 @@ class AmysqlModel {
|
||||
public function _row($sql, $result_type = MYSQL_ASSOC) {
|
||||
$result = $this->_query ( $sql );
|
||||
if (! $result)
|
||||
Return false;
|
||||
return false;
|
||||
$row = mysql_fetch_array ( $result, $result_type );
|
||||
$this->ResultSum = 1;
|
||||
$this->_free ( $result );
|
||||
Return $row;
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -391,7 +391,7 @@ class AmysqlModel {
|
||||
public function _all($sql, $result_type = MYSQL_ASSOC) {
|
||||
$result = $this->_query ( $sql );
|
||||
if (! $result)
|
||||
Return false;
|
||||
return false;
|
||||
$data = array ();
|
||||
$this->ResultSum = 0;
|
||||
while ( $row = mysql_fetch_array ( $result, $result_type ) ) {
|
||||
@ -399,7 +399,7 @@ class AmysqlModel {
|
||||
++ $this->ResultSum;
|
||||
}
|
||||
$this->_free ( $result );
|
||||
Return $data;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -411,8 +411,8 @@ class AmysqlModel {
|
||||
public function _sum($sql) {
|
||||
$result = $this->_query ( $sql );
|
||||
if (! $result)
|
||||
Return false;
|
||||
Return mysql_num_rows ( $result );
|
||||
return false;
|
||||
return mysql_num_rows ( $result );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -421,7 +421,7 @@ class AmysqlModel {
|
||||
* @param Object $rs
|
||||
*/
|
||||
public function _free($rs) {
|
||||
Return mysql_free_result ( $rs );
|
||||
return mysql_free_result ( $rs );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
class mail_model extends AmysqlModel {
|
||||
public function select($where) {
|
||||
$sql = "SELECT password, email FROM `authme` WHERE `username` = '" . $where;
|
||||
$sql = "SELECT email FROM `authme` WHERE `username` = '" . $where . "'";
|
||||
return $this->_all ( $sql );
|
||||
}
|
||||
public function mail($mail, $verify, $user) {
|
||||
@ -21,7 +21,7 @@ class mail_model extends AmysqlModel {
|
||||
}
|
||||
}
|
||||
public function status($user) {
|
||||
$sql = "SELECT * FROM `mail` WHERE `user` = '" . $user;
|
||||
$sql = "SELECT * FROM `mail` WHERE `user` = '" . $user . "'";
|
||||
return $this->_all ( $sql );
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ if (empty ( $_SESSION ['username'] ))
|
||||
<!-- navbar -->
|
||||
<div class="navbar navbar-inverse">
|
||||
<div class="navbar-inner">
|
||||
<a class="brand" href="index.php"><img src="img/logo.png" /></a>
|
||||
<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"
|
||||
data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span> <span class="icon-bar"></span> <span
|
||||
@ -102,7 +102,7 @@ if (empty ( $_SESSION ['username'] ))
|
||||
</div>
|
||||
<div class="field-box">
|
||||
<label>邮箱地址:</label> <input class="span5 inline-input" id="mail"
|
||||
type="text" value="" disabled="disabled" />
|
||||
type="text" value="" disabled="disabled" /><p id="status"></p>
|
||||
</div>
|
||||
<div class="field-box">
|
||||
<label>游戏币余额:</label> <input class="span5 inline-input" id="money"
|
||||
@ -123,9 +123,8 @@ if (empty ( $_SESSION ['username'] ))
|
||||
<script type="text/javascript">
|
||||
select();
|
||||
status();
|
||||
|
||||
var data = "user=<?=$_SESSION['username']?>";
|
||||
function select(){
|
||||
function select(){
|
||||
$.ajax({
|
||||
type:"GET",
|
||||
dataType:"json",
|
||||
@ -135,7 +134,7 @@ if (empty ( $_SESSION ['username'] ))
|
||||
$.each(rdata.info,function(index,content)
|
||||
{
|
||||
if(rdata.status == "success")
|
||||
{
|
||||
{
|
||||
$("#mail").val(content.email);
|
||||
}
|
||||
}
|
||||
@ -144,9 +143,9 @@ if (empty ( $_SESSION ['username'] ))
|
||||
alert("数据读取失败");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function status(){
|
||||
function status(){
|
||||
$.ajax({
|
||||
type:"GET",
|
||||
dataType:"json",
|
||||
@ -154,7 +153,7 @@ if (empty ( $_SESSION ['username'] ))
|
||||
url:"<?=Url('mail_status', "stat")?>",
|
||||
success:function(data){
|
||||
$.each(data.info,function(index,content)
|
||||
{
|
||||
{
|
||||
if(content.statu == 0)
|
||||
{
|
||||
$("#status").html("邮箱验证状态:尚未验证");
|
||||
@ -166,18 +165,18 @@ if (empty ( $_SESSION ['username'] ))
|
||||
error:function(){
|
||||
alert("邮箱验证状态读取失败");
|
||||
return false;
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
window.onload = function(){
|
||||
var html = $('.status').html();
|
||||
var html = $('#status').html();
|
||||
//document.write(html);
|
||||
if(html.indexOf("尚未验证") !== -1){
|
||||
$('.status').html($('.status').html()+ " <a href='<?=Url('index', 'mail')?>' onclick='display()'>点击这里进行验证</a>")
|
||||
if(html.indexOf("尚未验证") != -1){
|
||||
$('#status').html($('#status').html()+ " <a href='<?=Url('index', 'mail')?>' onclick='display()'>点击这里进行验证</a>")
|
||||
}
|
||||
}
|
||||
current();
|
||||
function current(){
|
||||
function current(){
|
||||
$.ajax({
|
||||
type:"GET",
|
||||
dataType:"json",
|
||||
@ -195,7 +194,7 @@ if (empty ( $_SESSION ['username'] ))
|
||||
error:function(){
|
||||
alert("尚未查询到此用户的游戏币余额");
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user