From ec7a26a5821b60d6e999cf0681a84d9cd29bec13 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Wed, 14 Oct 2015 21:07:36 +0800 Subject: [PATCH] fix MySQL error and fix message.php... Signed-off-by: 502647092 --- Amysql/Amysql.php | 40 ++++++++++++++++++++-------------------- Model/mail_model.php | 4 ++-- View/message.php | 29 ++++++++++++++--------------- 3 files changed, 36 insertions(+), 37 deletions(-) diff --git a/Amysql/Amysql.php b/Amysql/Amysql.php index 228baa1..02a3dd7 100644 --- a/Amysql/Amysql.php +++ b/Amysql/Amysql.php @@ -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" . '' . "\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 ); } } diff --git a/Model/mail_model.php b/Model/mail_model.php index 1afdcab..71b53be 100644 --- a/Model/mail_model.php +++ b/Model/mail_model.php @@ -1,7 +1,7 @@ _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 ); } } diff --git a/View/message.php b/View/message.php index 3e889ed..491f475 100644 --- a/View/message.php +++ b/View/message.php @@ -45,7 +45,7 @@ if (empty ( $_SESSION ['username'] ))