1
0
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:
502647092 2015-10-14 21:07:36 +08:00
parent af6a38d957
commit ec7a26a582
3 changed files with 36 additions and 37 deletions

View File

@ -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 );
}
}

View File

@ -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 );
}
}

View File

@ -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,7 +123,6 @@ if (empty ( $_SESSION ['username'] ))
<script type="text/javascript">
select();
status();
var data = "user=<?=$_SESSION['username']?>";
function select(){
$.ajax({
@ -170,10 +169,10 @@ if (empty ( $_SESSION ['username'] ))
})
}
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();